更改 JqGrid 列的顺序
我想动态更改网格列顺序。例如,默认情况下,网格将按 LoginId、FirstName 和 LastName 顺序加载。根据某些条件,我需要更改名字和姓氏序列。
我有什么办法可以做到这一点吗?
我尝试这样做:
{name:'UserName',index:'UserName',width:82,sortable:false},
if(true)
{
{name:'FirstName',index:'FirstName',width:65,sortable:false},
{name:'LastName',index:'LastName',width:65,sortable:false},
}
else
{
{name:'LastName',index:'LastName',width:65,sortable:false},
{name:'FirstName',index:'FirstName',width:65,sortable:false},
}
但我无法完成这项工作。
I wanted to change the grid column sequence dynamically. For e.g. By default the grid will be loaded in LoginId, FirstName and LastName sequence. Based on some condition, I need to change the FirstName and LastName sequence.
Is there any way I can do this?
I tried doing like:
{name:'UserName',index:'UserName',width:82,sortable:false},
if(true)
{
{name:'FirstName',index:'FirstName',width:65,sortable:false},
{name:'LastName',index:'LastName',width:65,sortable:false},
}
else
{
{name:'LastName',index:'LastName',width:65,sortable:false},
{name:'FirstName',index:'FirstName',width:65,sortable:false},
}
but I could not get this work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
remapColumns
函数来执行此操作。在该函数的文档中,您将找到以下示例:似乎是错误的,因为排列数组中的索引似乎是从 1 开始的,而不是从 0 开始的。尝试使用:或者
如果您想更改总共 9 列中第二列和第三列的顺序。
You can use
remapColumns
function to do this. In the documentation of the function you will find the example which seems to be wrong, because indexes in the permutation array seem to be 1-based and not 0-based. Try to use:or
if you want to change the order of the second and third from the total 9 columns.