Change Div Content Based on Selected Node

Discuss everything related to ApPHP TreeMenu. Any questions related to the ApPHP TreeMenu developing or using should be posted to this forum.

Moderators: alexandrleonenko, Milton

PHPDeveloper
Newbie
Newbie
Posts: 1
Joined: Aug 12th, '11, 15:10

Change Div Content Based on Selected Node

Postby PHPDeveloper » Oct 5th, '11, 00:52

Hey.

I downloaded 3 packages from APPHP about a month ago and I'm now trying to get them to work right. The first one I'm working on is TreeMenu, which I like very much, so far. From the perspective of the user, it looks good and functions quite nicely. So, I guess I could start by thanking you guys for doing such a nice job on that.

Unfortunately, I seem to have run into a difficulty. I'm having trouble accessing the value of the selected Node for any practical use.

I'd like to change the contents of a Div located on the page based on the node that is selected. I was under the impression that this TreeMenu was Ajax compatible, so I've been trying to figure out how to get the selected value, the value of the Node, from the returning Ajax call so that I can then call another Java function to set the InnerHTML of the Div whose contents that I want to change.

However, the only way the TreeMenu appears to return a result is in the form of a PHP "echo".

Just to be clear, I'll provide an example.

Whens the user clicks on "England", I have the value of the Node set to content for "England" that I would now like to display in my own Div, not in the "innercontainer" Div that TreeMenu seems to insist that I use. Currently, I can either send the output to the "innercontainer" or to another PHP file, which doesn't really help me. I'm trying to use Ajax because refreshing the page after each selection is not considered an option.

How does one retrieve the value of the selected Node for use in JavaScript without refreshing the page? Do the TreeMenu Nodes have an "onclick" function that can call a JavaScript function? I have a standard HTML ListBox that I could use instead. When I click on a value in the listbox, it triggers the relevant JavaScript function that sets my Div to the content I want. However, my standard HTML ListBox isn't really what I want to use for this purpose, since your TreeMenu provides for SubNodes that can be expanded and collapses, which is what I was looking for. Unfortunately, I can't seem to figure out how to do the same thing with your TreeMenu that I can do with my ListBox. How does one change the contents of a Div on the page, one that already exists, when the user clicks on a Node on the TreeMenu?

Thanks for the help! I read through all of the other posts in the forum for the TreeMenu and have not found an answer to the above question. If I missed it, I hope you'll provide a link to the relevant post.

Milton
Senior
Senior
Posts: 31
Joined: Jan 14th, '10, 14:17

Re: Change Div Content Based on Selected Node

Postby Milton » Oct 6th, '11, 17:20

You can get selected node's id in __tmPostBackAjax function in js/script.js file (newid parameter).

Hope that helps.

Ddamadosic
Newbie
Newbie
Posts: 1
Joined: Feb 13th, '15, 03:50

Re: Change Div Content Based on Selected Node

Postby Ddamadosic » Feb 13th, '15, 04:19

Me and my friend read this thing that has really good read.


Return to “ApPHP TreeMenu”