0

Putting check boxes enable and disable based on condition. For condition I need to access filed value which is in the model, not in the grid column.

How can I access the field value like in rowObject in the formatter?

$.subscribe("loadComplete", function(event, status, data){
    var grid = $("#linesgrid");
    var ids = grid.jqGrid('getDataIDs');
    for(var i=0;i < ids.length;i++){
        var rowId = ids[i];
        var rowData = jQuery('#linesgrid).jqGrid ('getRowData', rowId);
            if(rowData.filedvalue){
               $("#jqg_linesgrid_"+rowId).attr("disabled", true);  
            }

    }
});
Alex Riley
  • 169,130
  • 45
  • 262
  • 238
  • 1
    The usage of `jQuery('#linesgrid)` instead of `jQuery('#linesgrid')` is sure either an typing error or a syntax error. If you want to bind jQuery event you should use `jqGridLoadComplete` instead of `loadComplete` (see [the answer](http://stackoverflow.com/a/6778789/315935)). To answer on your question it's *really important* to know more details which shows how you create jqGrid. It's very important to know the values of the options like `datatype` and `loadonce`. Probably you should use `getLocalRow` method instead of `getRowData` to access the data. – Oleg Dec 26 '14 at 18:29

2 Answers2

0

the problem is in calling the function u need to concatinate it to the string like this

$.subscribe("loadComplete", function(event, status, data){   
 var grid = $("#linesgrid");     

 var ids = grid.jqGrid('getDataIDs');
 for(var i=0;i < ids.length;i++){
    var rowId = ids[i];
    var rowData = jQuery('#linesgrid).jqGrid ('+getRowData+', rowId);
        if(rowData.filedvalue){
           $("#jqg_linesgrid_"+rowId).attr("disabled", true);  
        }

}
});  
hussein shaib
  • 108
  • 1
  • 9
0

Added Hidden column to the Grid which don't display to the end user. Get the row data by using GetRowData Function, and used that value in the condition.

Thanks,