Add Additional Parameters to an ExtJS Tree Node Click
I recently encountered a situation in which I needed to send additional, dynamic parameters to a URL when an ExtJS tree node was clicked. After some trial and error, I discovered that I needed to add a TreeLoader object to my tree. (I was previously trying to use the dataUrl property of the tree itself.)
I had some parameters that were the same for each node. These I defined in the TreeLoader’s baseParams config.
The dynamic parameters I had to handle differently, since I wouldn’t know what they were until the tree node was actually clicked. To capture this click event, I defined the “beforenodeclick” event of the TreeLoader. Then, within this event, I retrieved individual attributes that had been defined for the node (in my case via a JSON packet) and added these to the TreeLoader’s baseParam config.
Example:
