日期:2014-05-16 浏览次数:20397 次
一,下面是扩展Class
?
Ext.define('Dncsoft.data.MyReader', { extend: 'Ext.data.reader.Json', alternateClassName: 'Ext.data.DncReader', alias : 'reader.dncreader', startDate: new Date(), endDate: new Date(), getResponseData: function(response) { var me = this; var data = me.callParent(arguments); return me.change(data); }, change: function(sourceJson) { var me = this; // filter data and sum value var map = new Ext.util.HashMap(); for (var i = 0, iEnd = sourceJson.length; i < iEnd; ++i) { map.add(_id, {"id":_id, "v":_v}); } return map.getValues(); } });
?
二,这是用扩展Class的地方。
?
var store = Ext.create('Ext.data.JsonStore', { model: 'Dncsoft.data.MyModel', buffered: true, purgePageCount: 0, proxy: { type: 'ajax', url: 'mydata.json', noCache: true, filterParam: undefined, groupParam: undefined, limitParam: undefined, startParam: undefined, sortParam: undefined, pageParam: undefined, reader: { model: 'Dncsoft.data.MyModel', type: 'dncreader', root: 'root', startDate: new Date('1/15/2011'), endDate: new Date('2/31/2013') } }, autoLoad: false });
?
?
?
//END