I’ve a jqgrid and a getCell method which returns the value of a cell depending of id. It works only for the first row of the grid, in others identifyImg = false:
var ids = jQuery("#myGrid").getDataIDs();
for(var i=0;i<ids.length;i++){
var identifyImg = $('#myGrid').jqGrid('getCell', i, 'idState');
alert(identifyImg); // return false after first row
if(identifyImg == '1'){
//DO SOMETHING
}
}
the column is defined as the follow:
{name:'idState',index:'idState', width:55}
And is correctly populated with numbers. How can I solve this?
you should use
instead of
I want additionally to mention that in the most cases one don’t need use loop over ids returned from
getDataIDs. It was a good approach in customizing of jqGrid inside ofloadCompleteorgridCompletein old versions of jqGrid. Now there are more better (from the performance point of view) alternatives. For example if you need to change some style or other attribute of one cell based on the content of one column you can usecellattr(see the answer, the answer, the answer, the answer or other). If you need to change some attributes of the whole row based on the content of one column you can userowattr(see the answer). In other cases if you need to change content of the cell (not an attribute) based on the content of another cell you can use custom formatter.