Error when calling ShowRow

Hi,
I am using the smartrendering for loading the grid. Now I would like to load the grid with specific row been selected. I am using
mygrid.showRow(“4”);
However I get this js error in firebug
TypeError: this.getRowById(a) is null
…eader=function(a){this.noHeader=convertStringToBoolean(a)};this.showRow=function…

in dhtmlxgrid.js file

Here is the code snippet.
mygrid = new dhtmlXGridObject(‘mygrid_container’);
mygrid.setImagePath(“codebase/imgs/”);
mygrid.setColAlign(“left,right,right”);
mygrid.setImagePath("/Images/");
mygrid.setColumnColor("#CCE2FE");
mygrid.splitAt(1);
mygrid.enablePaging(true, 100, null, “pagingArea”, true, ‘recinfoArea’);
mygrid.setSkin(“dhx_skyblue”);
mygrid.init();
mygrid.enableSmartRendering(true);
mygrid.loadXML(“SampleXML.xml”);
mygrid.showRow(“4”);

The xml that I am using has the format

1
FirstName LastName
123-456-7890
Marketing
M349
Location
United States
Yes

Please advice how to resolve this issue.

Thanks

Try removing the below line of code from your code snippet and see whether you see the row 4 as selected.

mygrid.splitAt(1);

Best
-Sam

Loading is async operation, so all data related command need to be called from the loading callback

mygrid.loadXML(“SampleXML.xml”, function(){
mygrid.showRow(“4”);
});

Thanks for your reply Sam and Stanislav.
Calling the command in the function resolved the error. However the row is not getting selected.
How can I get the row selected?

Thanks

What is happening is the row is getting selected, however it is not highlighted, so the user doesnt know the row is selected.
So how can I highlight the row so the user knows that the row is selected?

Thanks

I don’t see a selection code in the above snippet.
Try to use

mygrid.loadXML("SampleXML.xml", function(){ mygrid.showRow("4"); mygrid.selectRowById(4); });