Model 带有日期字段的Sencha Touch商店

Model 带有日期字段的Sencha Touch商店,model,sencha-touch,store,Model,Sencha Touch,Store,我有一个带有日期字段和存储的模型,它从XML加载,日期字段与字符串相同。sencha会自动解析它吗?还是我需要手动解析 Ext.regModel('News', { idProperty: 'Id', fields: [ { name: 'Id', type: 'int' }, { name: 'Title', type: 'string' }, { name: 'PostedOn', type: 'date' },

我有一个带有日期字段和存储的模型,它从XML加载,日期字段与字符串相同。sencha会自动解析它吗?还是我需要手动解析

Ext.regModel('News', {
    idProperty: 'Id',
    fields: [
        { name: 'Id', type: 'int' },
        { name: 'Title', type: 'string' },
        { name: 'PostedOn', type: 'date' },
        { name: 'PostedBy', type: 'string' },
        { name: 'Details', type: 'string' }
    ]
});

var newsRemoteStore = new Ext.data.Store({
    model: 'News',
    sorters: [{
        property: 'PostedOn',
        direction: 'DESC'
    }],
    proxy: {
        type: 'ajax',
        url: BaseURL + 'News.php',
        reader: {
            type: 'xml',
            root: 'News',
            record: 'New'   
        }
    },
    getGroupString: function(record) {
        if (record && record.data.PostedOn) {
            return record.get('PostedOn').toDateString();
        }
        else {
            return '';
        }
    }
});
我这样问是因为日期字段是空的,即使xml响应中有日期

<PostedOn>2011-07-04 16:00:19</PostedOn>
2011-07-04 16:00:19

否,sencha仅支持4种数据类型:int、float、string和auto


您应该将日期字段设置为字符串,然后将其转换为getGroupString中的日期对象,以将其与另一个日期对象进行比较。阅读这里的所有内容:

否,sencha仅支持4种数据类型:int、float、string和auto


您应该将日期字段设置为字符串,然后将其转换为getGroupString中的日期对象,以将其与另一个日期对象进行比较。阅读这里的所有内容:

Sencha Touch 1.1版支持自动、字符串、整数、浮点、布尔值和日期(请参阅Sencha Touch 1.1版支持自动、字符串、整数、浮点值、布尔值和日期(请参阅