Tree Event to update Grid?

Hi,

For each leaf of tree, I want to update Grid display. This part is using a separate tree and grid, not the treeGrid. When clicking an item in tree, the page should show the Grid items associated with that leaf.

How should I begin this?

Should I load all possible values of Grid for all leafs, and then use javascript to show/hide the rows? Would I use setRowHidden ? Is there a setRowVisible function in API?

Or should I try “Defining Row Level Parser”:
docs.dhtmlx.com/doku.php?id=dhtm … ta_loading

Can you point me to where I should look? Thanks!

You can catch “onSelect” event of the Tree and re-load Grid with new data:

tree.attachEvent("onSelect", function(id){ grid.clearAll(); grid.load(url); });

Additional question:
Does the tree support OnKeyPressed or any events to capture keys pressed?
Thanks!

Once I placed the tree and the grid both into the doOnLoad event, so they are inside the same Javascript, your solution worked.

Your code worked both times, using load and loadXML.

tree.attachEvent("onSelect", function(id){
	mygrid.clearAll();
	//mygrid.load("connect/get_mygrid.php");
	mygrid.loadXML("connect/get_mygrid2.php");
})

Which one should I be using, if I used Connector to load from MySQL?
Thanks!

Post deleted.

Which one should I be using, if I used Connector to load from MySQL?
It doesn’t matter. load() and loadXML() methods are aliases.

Does the tree support OnKeyPressed or any events to capture keys pressed?
All tree events are listed here docs.dhtmlx.com/doku.php?id=dhtm … s_handling

I looked there first. :slight_smile:
So, it is not possible to allow keyboard shortcut like Ctrl-V?
Thanks.

try to use onKeyPress event

This event is fired only if keyboard navigation is used:

tree.enableKeyboardNavigation(true)