/* * @Description: * @Author: hy * @Date: 2019-08-14 17:41:15 * @LastEditTime: 2019-08-19 15:50:58 */ Ext.define('uas.data.DataList', { requires: [ 'uas.data.Init' ] }, function() { var dataLists = []; for(let i=0;i<1000;i++){ dataLists.push({ id:(i+1), code:"PU"+(2019081900000001+Number(i))+"", status:(i%5)===0?"已审核":"在录入", date:"2019-08-19", vendor:(i%2)===0?"广东省深圳市南山区供应商A001":"广东省广州市天河区供应商B002", price:(Math.random()*(3000-1000)+10).toFixed(2), currency:"RMB", recordman:"小明", auditman:"大明", special:(i%2)===0?true:false, }) } //from https://git.daplie.com/Daplie/knuth-shuffle/ function shuffle (array) { array = Ext.Array.clone(array); var currentIndex = array.length, temporaryValue, randomIndex; // While there remain elements to shuffle... while (0 !== currentIndex) { // Pick a remaining element... randomIndex = Math.floor(Math.random() * currentIndex); currentIndex -= 1; // And swap it with the current element. temporaryValue = array[currentIndex]; array[currentIndex] = array[randomIndex]; array[randomIndex] = temporaryValue; } return array; } Ext.ux.ajax.SimManager.register({ type: 'json', delay: 300, url:/\/uas\/DataList/, data: function(ctx) { //获取过滤条件 // return Ext.Array.filter(dataLists, function(dataList) { // return dataList.id > start && dataList.id <= page*limit; // }); return dataLists } }); });