Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Guilherme on Apr 16, 2008 13:58
open dhtmlx forum
dhtmlxgrid: kidsxmlfile loads the entire xml data at the first load

Dear sirs,

The file "test.asp" runs a query which returns 50.000 rows from a database, in a xml format, to be showed in a dhtmlxGrid.

Obviously, we are using the "kidsxmlfile" property to implements dynamic loading.

We believe that, by the initial time of loading, all the 50.000 rows are being mounted in memory, to show only around ten root nodes.

When user clicks [+] in TreeView, we understand the "id" parameter of the <item> xml tag is the element used to filter the child rows, and the kidsxmlfile mechanism runs at the client-side.

1) The first need is to avoid to load the entire xml file. I don't know how.

2) We would like to use more than one parameter to control the data to be loaded (child rows). Each time a user clicks [+] in TreeView, we need to load few rows directly from a Database, whatever, passing parameters to the "test.asp", like this: "test.asp?product_id=X&customer_id=Y" where X and Y are <userdata> and depends of the clicked node.

Thanks,

Guilherme
Answer posted by Support on Apr 17, 2008 02:01
>>1) The first need is to avoid to load the entire xml file. I don't know how
In case of dynamic loading you have in code something similar to next

    grid.kidsXmlFile="child_brahches.do"
    grid.loadXML("main.do");

so the script used as parameter of grid.loadXML must return only top level elements with "xmlkids" attribute where it necessary


>>like this: "test.asp?product_id=X&customer_id=Y" where X and Y are <userdata> and depends of the clicked node.
Can't be done by grid's API, but can be achieved with pretty simple code modification.

dhtmlxtreegrid.js  line 201
    this.loadXML(this.kidsXmlFile+""+s+"id="+r.id);
can be replaced with
    this.loadXML(this.kidsXmlFile+""+s+"product_id="+this.getUserData(id,"b")+"&customer_id="+this.getUserData(id,"a"));