Styling parent in dhtmlXTreeGrid

Hi,

Could anyone tell me if there is anyway to apply styling to the top level parent in dhtmlXTreeGrid?

Right now I am doing this

mygrid.parse(data,function(){
mygrid.attachEvent(“onRowCreated”,function(id){
var allRowId = mygrid.getAllRowIds();
allRowId = allRowId.split(",");
for(var i = 0; i < allRowId.length; i++)
{
if(check if the row is parent or not){
//apply css
}
}
})
});


When there is a large amount of data IE is showing “Stop running script” alert because of the above code. Is there any other efficient way to apply css to only top level parents?

You may apply the required css to the needed rows right in your xml:

<row id="12" class="css1" bgColor="red" style="color:blue;"> <cell> first column data </cell> <cell class="css2" style="font-weight:bold;"> second column data </cell> </row>

Th data in our application is converted into xml dynamically through @Root and the same is used in different pages . the styling is required in only one page.

Is there not a way to do it in javascript ?

You may try use forEachRow iterator with the FAST mode of the grid if it will help.
Something like this:

mygrid.load(url,function(){ mygrid.startFastOperations(); //starts "FAST" mode mygrid.forEachRow(function(id){ if(check if the row is parent or not){ //apply css } }); mygrid.stopFastOperations();//stops "FAST" mode(all events skipped between start and stop) });
Unfortunately there is no other solution

The function is not executed when written in between fast mode.
There is no error. The function is not executed.

Any ideas why?

I apologize. my fault for the bad advise.
forEachRow method won’t be executed in the fast mode.
You may iterate through your rows using the classic “for” iterator:

mygrid.load(url,function(){ mygrid.startFastOperations(); //starts "FAST" mode for (var i=0; i<mygrid.getRowsNum(); i++){ var id=mygrid.getRowId(i); if (check if the row is parent or not){ // apply css } }; mygrid.stopFastOperations();//stops "FAST" mode(all events skipped between start and stop) });

This solution is not removing the slow script popup

Unfortunately there is no other way to improve the performance in this case.
I may only suggest again to set all your style from the server-side.