不想在jqGrid中加载页面后第一次显示排序图标 [英] Don't want to show sorting icon for the first time after page load in jqGrid

查看:149
本文介绍了不想在jqGrid中加载页面后第一次显示排序图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jqGrid并通过JSON加载数据.第一次获取数据时,我使用自定义方法对数据进行排序并将数据传递到网格.但是,它始终在第一列上显示我不想显示的排序图标,因为自定义方法会使用多次计算对数据进行排序,但是当排序图标出现在第一列时,会向用户发送错误消息.

I am using jqGrid and loading data through JSON. for the very first time when I get the data I sort that using custom method and pass that data to grid. But it always display sorting icon on the first column which I don't want to show because custom method sort the data using several calculations but when sorting icon appears on first column then a wrong message goes to the user.

我无法使用行号,因为它无法对行号中的数据进行排序,因此试图CSS显示:无,但会永久隐藏图标.

I can not user rownumbers as it sorts data on row numbering, tried CSS to display:none but that hide the icon permanently.

仅当有人单击任何标题或可排序标题时,才显示图标.

icon should only be displayed if someone clicks any or the sortable header.

有人可以帮忙吗?

推荐答案

如果您不使用rownumbers: true或其他一些在网格中添加第一列的选项,则可能会出现问题.作为解决方法,您可以使用以下选项

The problem could exist if you don't use rownumbers: true or some other options which adds one more first columns in the grid. As a workaround you can use the following option

lastsort: "0"

重要的是,将lastsort的值用作字符串而不是数字(lastsort: "0"而不是lastsort: 0,这是默认值).

It's important to use the value of lastsort as string and not as number (lastsort: "0" and not as lastsort: 0 which is default).

更新:我发布了请求请求修改jqGrid代码以消除您描述的问题.

UPDATED: I posted the pull request which suggest modification of jqGrid code to eliminate the problem which you describe.

更新2: 提取请求今天已合并到github上jqGrid的主要代码.因此,将要发布的下一版本的jqGrid(更高版本为4.6.0)应该不会遇到您所描述的问题.

UPDATED 2: The pull request is merged today to the main code of jqGrid on github. So the next version of jqGrid (higher as 4.6.0) which will be published should not have the problem which you described.

这篇关于不想在jqGrid中加载页面后第一次显示排序图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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