JQgrid 在客户端按特定格式对日期进行排序

发布于 2024-10-09 06:24:47 字数 157 浏览 0 评论 0原文

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

提前致谢!

谨致

Phani Kumar

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?

Thanks in Advance!

With Regards

Phani Kumar

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

二手情话 2024-10-16 06:24:47

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

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

“因此您可以用一种格式填充网格”(默认格式形式是ISO日期格式Ymd,我建议您使用这种格式)。您还可以使用 Date 类型作为本地数据的输入。选项newformat定义将向用户显示的数据格式。在内部,日期将按 Date JavaScript 类型保存和排序。

为了使我上面解释的内容易于实际使用,我创建了一个小的 演示 示例您可以实时查看并检查它的 JavaScript 代码。

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'}

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.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文