0

I have a struts2-jquery jqGrid page with a grid that uses the event dialog boxes. I'm trying to bind the event afterclickPgButtons to the edit dialog. I can bind events to the entire grid (gridTable), but I'm having issues binding the event to the dialog box. I want to modify the contents of elements AFTER the edit dialog info changes when using the next/prev button inside the edit dialog.

$("#editmodgridtable").bind("afterclickPgButtons", function(whichbutton, formid, rowid){
    alert("Hey!");
});

I'm trying to run the below inside the loadComplete and bind to jqGridAddEditAfterShowForm thinking I need to do the final bind after the page loads and after the form is displayed.

$.subscribe('loadComplete', function(event, data) {
    $("#gridtable").bind("jqGridAddEditAfterShowForm", function (e, $form, oper) {
        $("#editmodgridtable").bind("afterclickPgButtons", function(whichbutton, formid, rowid){
    alert("Hey!");
        });
     }
}

However, the code above seems to be cumbersome and the bind to afterclickPgButtons does not work. How do I get the afterClickPgButtons to workAny help is greatly appreciated.

4

1 回答 1

1

我不确定哪个是您使用的网格的 id:"editmodgridtable""gridtable". 你应该绑定"jqGridAddEditAfterShowForm""jqGridAddEditAfterClickPgButtons"或者"jqGridLoadComplete" 直接绑定。进行绑定时,事件并不重要。主网格 ( <table id="gridtable"></table>) 的表应该在绑定之前存在。所以正确的代码可能非常简单

var $grid = $("#gridtable");

$grid.bind("jqGridLoadComplete", function (e, data) {
    alert("In jqGridLoadComplete");
});

$grid.bind("jqGridAddEditAfterShowForm", function (e, $form, oper) {
    alert("In jqGridAddEditAfterShowForm");
});

$grid.bind("jqGridAddEditAfterClickPgButtons", function (e, whichButton, $form, rowid) {
    alert(whichButton + " " + rowid);
});
于 2015-06-17T05:39:27.243 回答