Struts2 jqGrid绑定afterclickPgButtons以编辑对话框 [英] Struts2 jqGrid Bind afterclickPgButtons to Edit Dialog
问题描述
我有一个带有使用事件对话框的网格的struts2-jquery jqGrid页面.我正在尝试将afterclickPgButtons事件绑定到编辑对话框.我可以将事件绑定到整个网格(gridTable),但是在将事件绑定到对话框时遇到了问题.我想在使用编辑对话框中的下一个/上一个"按钮时,在编辑对话框信息更改后修改元素的内容.
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!");
});
我正在尝试在loadComplete内部运行以下内容,并绑定到jqGridAddEditAfterShowForm,以为我需要在页面加载后和显示表单后进行最后的绑定.
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!");
});
}
}
但是,上面的代码似乎很麻烦,并且绑定到afterclickPgButtons无效.我如何使afterClickPgButtons起作用任何帮助都将不胜感激.
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.
推荐答案
我不确定您使用的网格ID是"editmodgridtable"
还是"gridtable"
.您应该直接绑定"jqGridAddEditAfterShowForm"
,"jqGridAddEditAfterClickPgButtons"
或"jqGridLoadComplete"
.进行绑定时,这并不重要.主网格的表(<table id="gridtable"></table>
)应该在绑定之前就存在.因此正确的代码可能非常简单
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);
});
这篇关于Struts2 jqGrid绑定afterclickPgButtons以编辑对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!