I'm looking for an example of how to use QueryReadStore (or some other store) with dojox.grid.LazyTreeGrid ?
I want to be able to display big structures and load only necessary required data from server. Only children of open nodes should be loaded from dedicated server script.
I'm already using QueryReadStore with dojox.grid.DataGrid and it works great :)
Help, Thanks.
I think I have what you are looking for here. Some excellent example code on using QueryReadStore with dojox.grid.LazyTreeGrid, and it's fully explained step by step too.
Please see here: http://livedocs.dojotoolkit.org/dojox/grid/LazyTreeGrid
I hope this advances your work and you are able to accomplish your goals.
Regards
Frank.
Here is a long-winded explanation/sample based on some stuff I am currently doing. This assumes basic comfort with Dojo 1.7-style packages (for instance, we assume the default Dojo packages are correctly set-up).
Client-side (js file)
Server-side:
You need a server-side handler that will listen to GET requests on
url/to/load/rows
. Those requests will have up to 3 parameters:That handler can be written in your favorite server-side language (i.e. C# with ASP.Net MVC, Ruby, etc.)
The job of your server handler will be to return a json structure containing the following 3 attributes:
Client/Server communication
To build upon my previous example, as soon as the grid is started-up (client-side), it will request something like:
The server would return the following:
The grid will display the 2 fruits.
apple
will have an expando, but notwatermelon
(due to thechildren
attribute). Assume the user clicked on theapple
expando. The grid will request its children:The server could return something like:
The grid will then display a single child under the
apple
row.