gird. setRowColor does not work

Hi,
I use dhtmlxgrid ver 2.6. standard edition.

I encountered with problem of using setRowColor. I use samplecode 12_initialization_loading/04_grid_refresh.html. Where after the string mygrid.loadXML("…/common/grid.xml");
I add
mygrid.setRowColor(mygrid.getRowId(6),“red”);

When browser loads this sample directly from file row 6 has red color.

When i try to load this sample via apache server then the sample loads succesfully but row 6 has not red color and there is an error “r is null” in string 213 in the dhtmlxgrid.js

Yo should call setRowColor() method only after all rows areloaded:

mygrid.loadXML("../common/grid.xml",function(){ mygrid.setRowColor(mygrid.getRowId(6),"red"); });

thanks a lot

I’m having the same problem as well but your fix doesn’t seem to work for me. I’m not sure what do do from here.

            function deleteProfile()
            {
                var answer = confirm('Are you sure you wish to delete this profile?');
                if(answer)
                {
                    var selId = mygrid.getSelectedId();
                    rowId = mygrid.getRowId(selId);
                    mygrid.setRowColor(rowId, "red");
                    postData = "serverip=" + array[selId-1][0];
                    ajaxFunction(postData,'index.php/welcome/ajaxDeleteProfile');
                }
            }

Try to use setRowTextStyle() method:

mygrid.setRowTextStyle(rowId,"background-color:red");