Struts2 jqGrid Bind afterclickPgButtons to Edit Dialog

情到浓时终转凉″ 提交于 2019-12-12 04:04:04

问题


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.


回答1:


I'm not sure which is the id of the grid which you use: "editmodgridtable" or "gridtable". You should bind "jqGridAddEditAfterShowForm", "jqGridAddEditAfterClickPgButtons" or "jqGridLoadComplete" directly. It's event not important when you make the binding. The table of the main grid (<table id="gridtable"></table>) should just exist before binding. So the correct code could be very simple

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


来源:https://stackoverflow.com/questions/30877528/struts2-jqgrid-bind-afterclickpgbuttons-to-edit-dialog

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