JQgrid 在客户端以特定格式对日期进行排序 [英] JQgrid Sorting date on the client side with a specific format

查看:17
本文介绍了JQgrid 在客户端以特定格式对日期进行排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 JQGrid 来存储正在加载到客户端本身的数据.我想对自定义格式的日期进行排序(即 2010 年 11 月 11 日).我想在客户端对其进行排序(由于要求).你们中的任何人都可以建议我需要做什么吗?

I am using JQGrid to store the data which is being loaded on the client side itself. I want sort the date which is in a customized format(i.e. 11-Nov-2010). I want to sort it on the client side (due to the requirement). Can anyone of you suggest me what I need to do?

提前致谢!

问候

帕尼库马尔

推荐答案

jqGrid 支持 日期格式化程序.它允许以您喜欢的 格式 在网格中显示日期.您只需要选择相应的格式化程序选项,如

jqGrid support date formatter. It allows to display the date in the grid in the format which you prefer. You need only the choose the corresponding formatter option like

sorttype:'date', formatter:'date', formatoptions: {newformat:'d-M-Y'}

所以你可以用一种格式填充网格(默认格式是 ISO 日期格式 Y-m-d,我建议你使用这种格式).您还可以使用 Date 类型作为本地数据的输入.newformat 选项定义将向用户显示的数据格式.在内部,日期将被保留并排序为 Date JavaScript 类型.

So you can fill the grid in one format (default format form is ISO Date format Y-m-d and I recommend you to use this format). You can also use Date type as input for the local data. The option newformat define the format of data which will be displayed for the user. Internally the date will be hold and sorted as the Date JavaScript type.

为了便于实际使用我上面解释的内容,我创建了小型 demo 示例,您可以实时查看并检查它的 JavaScript 代码.

To make easy to use practically what I explained above I created small demo example which you can see live and examin it's JavaScript code.

这篇关于JQgrid 在客户端以特定格式对日期进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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