jqgrid getRowData returns null

孤街浪徒 提交于 2019-12-03 13:21:35

问题


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?


回答1:


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


来源:https://stackoverflow.com/questions/7179191/jqgrid-getrowdata-returns-null

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!