开发者

jqgrid getRowData returns null

开发者 https://www.devze.com 2023-03-30 17:27 出处:网络
I have the code below: $butt开发者_Python百科onoptions = array(\"#pager\", array( \"caption\" => \"Select Product\",

I have the code below:

$butt开发者_Python百科onoptions = 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?


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');
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号