具有日期和时间的Dojo datagrid [英] Dojo datagrid with date and time

查看:60
本文介绍了具有日期和时间的Dojo datagrid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以有人在这里,为了上帝的爱!发布一个工作的dojox.grid.DataGrid的例子,使用dojox.data.JsonRestStore,具有2列,日期和时间?

Could someone here please, for the love of God!, post an example of an working dojox.grid.DataGrid using a dojox.data.JsonRestStore, with 2 columns, date and time?

我尝试了以下内容:

<th field="startdate" cellType="dojox.grid.cells._Widget" widgetClass="dijit.form.DateTextBox" editable="true" formatter="formatDate"></code></pre> and 
<th field="starttime" cellType="dojox.grid.cells._Widget" widgetClass="dijit.form.TimeTextBox" editable="true" formatter="formatDate">

另外:

<th field="startdate" cellType="dojox.grid.cells.DateTextBox" editable="true" formatter="formatDate"></code></pre> and 
<th field="starttime" cellType="dojox.grid.cells._Widget" widgetClass="dijit.form.TimeTextBox" editable="true" formatter="formatDate">

但似乎没有任何工作。现在已经有两天了,我一直在阅读大量的文档和报告,但是在任何地方找不到工作示例。

but nothing seems to work. It's been two days now and I've been reading tons of documentation and reports but I couldn't find a working example anywhere.

编辑:

我现在面临着我程序员职业生涯中最奇怪的问题:网格现在可以使用DateTextBox和TimeTextBox(这种情况适用于Firefox 3.6.6和3.6.14pre,Internet Explorer 8和Google Chrome。)除了以下内容外:

I am now facing the weirdest issue in my programmer's career : the grid is now working fine with DateTextBox and TimeTextBox (this case works in Firefox 3.6.6 and in 3.6.14pre, Internet Explorer 8 and Google Chrome.), except for the following :

在Firefox 3.6.13中,网格中的项目数量均匀,当我尝试编辑时间或日期一个元素的小部件框出现在左上角,日期未正确选择,浏览器崩溃,CPU将达到100%。

In Firefox 3.6.13, with an even number of items in the grid, when I try editing the time or date of one element the widget box appears in the top left corner, the date isn't selected properly and the browser crashes with the CPU going to 100%.

但是,如果项目数量是奇数编辑日期和时间的工作很好。我完全不知道该怎么做,请反弹一些想法。

However, if the number of items is odd the editing of date and time works just fine. I have absolutely no idea of what to do so please bounce some ideas.

推荐答案

你可以将网格中的值保持为日期类型,但与您的自定义格式....网格将照顾排序.....不需要写一些简单的字段的定制排序,如日期....
......

you can keep the values in the grid to be date type but with your customized format....the grid will take care of sorting.....no need to write customized sorting for some simple field like Date.... ......

var yourLayout = [[
 { 'name': 'Date', 'field': 'dateCol', 'width': '15%', 'formatter': this.formatDate}
]];

..............

..............

formatDate: function(dateValue) {
                return dojoLocale.format(dateValue, { selector: 'date', formatLength: 'long' });
        }

......

这篇关于具有日期和时间的Dojo datagrid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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