Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Mort Reddov on Dec 18, 2008 11:38
open dhtmlx forum
dhtmlxGrid: appending children-rows to parent-rows via updateFromXML

I am using the standard version of dhtmlxGrid.

When I use a script as below, the new row is properly appended to the "parent" row:

function doOnRowSelected(rowID,celInd){
var newId = (new Date()).valueOf();
var newPos = grid.getRowIndex(rowID) + 1;
grid.addRow(newId,["blahblahblah..."],newPos);
}

However, when I try to use the "updateFromXML" function and make use of "posStart"

function doOnRowSelected(rowID,celInd){
var newPos = grid.getRowIndex(rowID) + 1;
var url = initURL + '?posStart=' newPos;
grid.updateFromXML(url);
}

and use the "posStart" parameter in the top "<rows>" tag

out.println("<rows total_count=\"" + totalCount + "\" pos=\"" + posStart + "\">");

the new rows are always added at the bottom of the grid list.

Is there a way to make this work using "updateFromXML"?

Is there also a way to show/hide existing rows in the grid?

Sadly, I cannot (yet) buy the pro version of dhtmlTreeGrid.
I guess that would solve most of those problems...

Thanks for your time and help!
Mort
Answer posted by Support on Dec 19, 2008 01:53
>>using "updateFromXML"
updateFromXML operation updates existing list of rows and adds new one always to the end of list ( end of current branch in case of treegrid )
It not possible to add new row to specific position from XML , can be done only by js command. 

>>Is there also a way to show/hide existing rows in the grid?
Technically can be done by 
    grid.setRowHidde(id,mode); //mode - true/false
but if you need to show | hide row many rows at once - filtering api ( grid.filterBy ) will be a much more faster solution.