开发者

How to get the list of columns after adding and removing columns in jqgrid

After I add and remove columns in jqgrid, how do I get a list of the columns that are displayed?

When I call the method:

jQuery("#lis开发者_JAVA百科t").jqGrid('columnChooser',{ "msel_opts": $.ui.multiselect.defaults, "done": function (permut) {
        var colnames = $("#list").jqGrid('getGridParam', 'colModel');
  }
});

Colnames returns back with the original set of columns and not the updated list after the columns have been removed or added.


I did't test this, but I suppose that the problem that you should first call

$("#list").jqGrid("remapColumns", permut, true);

inside of done event handler and then test the colModel elements for hidden:true property. You should have now not only the correct value of the hidden property, but the correct order of columns too.

Additionally I see no need to use "msel_opts": $.ui.multiselect.defaults option. Probably you have some other problems which you try to fix. I recommend you verify that you included all dependencies of the columnChooser correctly. See here for details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜