将自定义按钮添加到 jqGrid ColumnChooser 对话框中
Add custom button into jqGrid ColumnChooser dialog
我想将自定义按钮添加到“列选择器”对话框中,并使它的行为与其他按钮一样。我试着得到类似 this(Default button)
的东西
_this.table.jqGrid("navButtonAdd", _this.pid, {
caption: "",
buttonicon: "icon",
title: "Title",
onClickButton: function() {
return self.table.jqGrid("columnChooser", {
done: function(perm) {
if (perm) {
self.table.jqGrid("remapColumns", perm, true);
return $(window).triggerHandler("resize.jqGrid");
}
},
dialog_opts: {
modal: true,
resizable: false
},
msel_opts: {
dividerLocation: 0.5
},
width: 460
});
}
});
您可以通过以下方式进行:
onClickButton: function () {
$(this).jqGrid("columnChooser", {
dialog_opts: {
buttons: {
Default: function () {
alert("Default button is clicked!");
}
}
}
});
}
The corresponding demo 显示以下结果:
我想将自定义按钮添加到“列选择器”对话框中,并使它的行为与其他按钮一样。我试着得到类似 this(Default button)
的东西 _this.table.jqGrid("navButtonAdd", _this.pid, {
caption: "",
buttonicon: "icon",
title: "Title",
onClickButton: function() {
return self.table.jqGrid("columnChooser", {
done: function(perm) {
if (perm) {
self.table.jqGrid("remapColumns", perm, true);
return $(window).triggerHandler("resize.jqGrid");
}
},
dialog_opts: {
modal: true,
resizable: false
},
msel_opts: {
dividerLocation: 0.5
},
width: 460
});
}
});
您可以通过以下方式进行:
onClickButton: function () {
$(this).jqGrid("columnChooser", {
dialog_opts: {
buttons: {
Default: function () {
alert("Default button is clicked!");
}
}
}
});
}
The corresponding demo 显示以下结果: