如何使用rowID参数向jqGrid添加重定向按钮

时间:2017-12-07 08:46:55

标签: button jqgrid parameter-passing formatter rowid

我使用jqGrid在屏幕上显示数据库表,我需要在每行的末尾添加一个按钮,将我重定向到另一个页面(让我们称之为page2.php)AND将行ID的值传递给该页面。

我在colModel中添加了一个带有格式化程序的列,但我似乎无法找到添加功能按钮的正确功能(重定向工作正常,但我在ID传递时遇到问题):< / p>

{name:'refresh', index:'refresh', width:70, align:'center', formatter:refreshButton}

以及相应的功能:

function refreshButton(cellvalue, options, rowobject){
    return '<button type="button" onclick="window.location=\'page2.php\'">Go</button>';
}

我发现某个地方?id="+rowid+"&oper=edit之后添加page2.php会传递rowID,但重定向再也无法工作......

我很乐意在此提前给予帮助

1 个答案:

答案 0 :(得分:0)

只要我点击按钮

,此代码就适用于我
function refreshButton(cellvalue, options, rowobject) {
    return '<button type="button" onclick="location.href=\'page2.php?oper=edit&id='+options.rowId+'\'">Go</button>';
}
相关问题