如何在 jqgrid 中动态更改 colNames 和 colModel?

How to change colNames and colModel dynamically in jqgrid?

我必须 add/remove jqgrid 的 colNames 和 colModel 动态不使用 hide/show 而不卸载或销毁 jqgrid。可能吗?

Adding/removing 列对于 jqGrid 的所有现有功能来说并不容易,但我在 jquery.jqgrid.min.js.

之后写了 addColumn method some years ago, which implements adding of columns dynamically (no removeColumn). To use the method you need to add the file jQuery.jqGrid.addColumn.js

另一方面,重新创建 jqGrid 并不好,但它可以安全且快速地工作。因此,我仍然建议您也考虑使用 GridUnload