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:

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.