且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我想通过单击jqGrid中的按钮来添加新列

更新时间:2023-12-01 13:50:40

这并不是您所要的,但是我们通过在表中包括希望它们出现的所有列来实现此目的,但要使用我们最初要隐藏的属性上的"hidden:true"属性.

It's not exactly what you're asking for, but we achieve this by including all the columns in the table where we want them to appear, but with a "hidden:true" property on the ones we want to be hidden initially.

然后,我们在复选框的显示列"列表中添加了一些jQuery魔术,以调用jqGrid showCol方法在用户要求时显示这些列.

We then have a "Show Columns" list of checkboxes with a bit of jQuery magic to call the jqGrid showCol method to show those columns when the user asks for them.