jQGrid - 更改列的顺序 [英] jQGrid - Change Order of Columns

查看:193
本文介绍了jQGrid - 更改列的顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个JQGrid,它通过AJAX加载数据并获得JSON响应。

I have a JQGrid which is loading data via AJAX and getting an JSON response.

我想知道是否有办法改变列的顺序在网格的colModel中,不影响单元数据的映射?

I would like to know if there is a way to change the order of columns in the colModel of the grid without affecting the mapping of the cell data?

提前致谢,
Thomas

Thanks in advance, Thomas

推荐答案

jqGrid API中有一个名为 remapColumns

There is a method in jqGrid API called remapColumns:

$("#list").remapColumns([0,2,1,3,4],true,false);

在一些旧版本的jqGrid中出现错误 - >置换数组中的索引是基于1的,而不是从0。您还应该记住,所有其他/隐藏列(rownumber,multlectlect等)也会被计算在内。

There was an error in some older versions of jqGrid -> indexes in the permutation array were 1-based, not 0-based. You should also remember that all additional/hidden columns (rownumber, multiselect, etc.) are counted as well.

这篇关于jQGrid - 更改列的顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆