cancel
Showing results for 
Search instead for 
Did you mean: 

i5Grid getRowCount() is not working on page loading

0 Kudos
636

when the page loads am trying to get the number of rows in the i5Grid but am not sure why it shows 0 row count. The only time where I could see the row count is when the i5Grid is selected.

Below is the sample code:

var grid_c0c0 = new com.sap.xmii.grid.init.i5Grid("grid template path","query templ path",true);
grid_c0c0.registerCreationEventHandler(ceController.addObject("c0c0",grid_c0c0));
grid_c0c0.draw("gridc0c0");
alert("initial"+grid_c0c0.getGridObject().getRowCount());

I couldn't figure out what is the issue. Any help would be Appreciated.

Thanks

Sap

View Entire Topic
agentry_src
Active Contributor
0 Kudos

Try getting the rowcount after the page has completed loading as Christian suggested.

0 Kudos

I actually need the row count before the page completes loading. I have few more requirements like changing the color of certain cells in the i5Grid based on few conditions and to use setCellValue to set some values on i5Grid based on conditions.

Anything I try using getGridObject() method doesn't work. But it seems to be working after OnSelection event .

Below is the error message which I could see in console

SCRIPT438: Object doesn't support property or method 'getRowCount'

agentry_src
Active Contributor

I don't think that will work since the object you are trying to read does not exist until after the grid is populated. So let it populate, then get your rowcount and do your updates afterwards. There are probably several other ways to hold the information before passing it to the grid, but I would recommend this approach as simpler and easier to maintain.

Regards, Mike

0 Kudos

Thanks Mike & Christian for your inputs! Am currently populating the grid and then doing my updates.