Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jqgrid getRowData returns null

I have the code below:

$buttonoptions = array("#pager", 
    array(
        "caption" => "Select Product",
        "onClickButton" => "js: function() {
            var selr = jQuery('#grid').jqGrid('getGridParam', 'selrow');
            var kelr = jQuery('#grid').jqGrid('getRowData', 'product_cat_id');
            if(selr) { 
                alert('grid.php?advice=' + selr + kelr); 
            } else {
                alert('Please Select a Product!');
                return false;
            }
        }"
    )
);

I successfully got the row ID in the following way:

var selr = jQuery('#grid').jqGrid('getGridParam','selrow');

But couldn't get the data of the selected row's product_cat_id column.

What is wrong?

like image 878
dr.linux Avatar asked Aug 24 '11 16:08

dr.linux


1 Answers

You use getRowData in a wrong way. Try

var kelr = jQuery('#grid').jqGrid('getCell', selr, 'product_cat_id');

or

var rowData = jQuery('#grid').jqGrid('getRowData', selr);    
var kelr = rowData.product_cat_id;

instead of

var kelr = jQuery('#grid').jqGrid('getRowData','product_cat_id');
like image 96
Oleg Avatar answered Sep 21 '22 20:09

Oleg