Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Josele on Mar 26, 2008 09:37
open dhtmlx forum
SetRowColor and enablePagingin dhtmlxGrid

Hello, my company bought your library a year ago, and now I am using it in my project.

I have a question that I don't really know how to fix. I am enabling paging in my grid, in fact I am using enabling paging with toolbar because is cooler. But the way I was using to set the color of rows was the following:

mygrid.enablePagingWT(true,10,35,"pagingArea");

mygrid.setImagePath("img/");

mygrid.setOnLoadingEnd(endQuery);

...

function endQuery(rowid, severity){

if(severity == 'FATAL')

{

mygrid.setRowColor(rowid,'red');

mygrid.setRowTextStyle(rowid,"color:#FFFFFF");

}

...

The problem with paging is I have noticed that endQuery function is only called for the first page, for the other pages the function is not called, so that my rows are not painted in the correct color.

Could you please tell me how to fix this? I imagine that that setting the color of the row when the loading has finished is not the best practice, but I don't know which event should I use.

Thank you very much!

Answer posted by Support on Mar 26, 2008 11:26
I'm not pretty sure which version of component you are using, but nearly any of them must support onPageChanged event

grid.attachEvent("onPageChanged",function(){
      // code placed here will be called each time when page changed
});

// old version of grid use setOnPageChanged instead of attachEvent

By the way, you can set css fro row directly in xml (  style or class attribute of row tag), but support of this feature also depend on used version.
Answer posted by Josele on Mar 27, 2008 01:32

Thank you very much for replying so quickly. SetOnPageChanged worked perfectly.

Thanks for this great library!