浏览 2081 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2010-04-16
最后修改:2011-02-16
官方提交bug详情:Ext.data.ArrayReader.readRecords have a bug when mapping 'prop1.propNext' * Ext 3.2.0 var record = Ext.data.Record.create([ {name: 'id', mapping: 'id'}, {name: 'name', mapping: 'text'}, {name: 'info', mapping: 'userData.info'}, {name: 'order', mapping: 'userData.order'} ]); var store = new Ext.data.Store({sortInfo: {field: 'order'}, reader: new Ext.data.ArrayReader({id: 'id'}, record)}) var win = new Ext.Window({ closable: false, layout: 'fit', width: 700, height: 400, items: [{ xtype: 'grid', title: ' ', iconCls: 'x-tree-node-icon-folder', tbar: ['-', {text: 'refresh'}, '-', '->'], columns: [ {header: 'ID', dataIndex: 'id', menuDisabled: true, hidden: true, width: 40, sortable: true, align: 'right'}, {header: 'name', dataIndex: 'name', hideable: false, width: 80, sortable: true}, {header: 'info', dataIndex: 'info', width: 100, sortable: true}, {header: 'order', dataIndex: 'order', width: 40, sortable: true, menuDisabled: true} ], store: store }] }); win.show(); var datas = []; for (var i = 0; i < 10; i++) { datas[i] = {id: i, text: 'text' + i, userData: {info: 'info' + i, order: i % 5}}; } store.loadData(datas); var record = Ext.data.Record.create([ if (Ext.version == '3.2.0') { Ext.apply(Ext.data.ArrayReader.prototype, { readRecords : function(o){ this.arrayData = o; var s = this.meta, success = true, v; var records = this.extractData(this.getRoot(o), true); var totalRecords = records.length; if(s.totalProperty) { v = parseInt(this.getTotal(o), 10); if(!isNaN(v)) { totalRecords = v; } } if(s.successProperty){ v = this.getSuccess(o); if(v === false || v === 'false'){ success = false; } } return { success : success, records : records, totalRecords : totalRecords }; } }); }
声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |