RT,在EXT4中有一个示例:example/grid/infinite-scroll.html的执行情况,对示例代码进行修改本地应用时总是无法成功。后台数据正常返回,前台grid一直加载中直到请求超时后滚动加载图标消失。
调试发现错误提示:Uncaught SyntaxError: Unexpected token
所请求URL:/warnConsoleJson/?_dc=1347865493130&total=26&page=1&start=0&limit=10&sort=id&dir=DESC&callback=Ext.data.JsonP.callback1
1 Ext.onReady(function(){ 2 Ext.define('ForumThread', { 3 extend: 'Ext.data.Model', 4 fields: [ 5 'id', 6 'assetNum', 7 'bscName', 8 'status', 9 'sourceMsg', 10 'newMsg', 11 'operStatus', 12 {name: 'created', type: 'date', dateFormat: 'timestamp'} 13 ], 14 idProperty: 'id' 15 }); 16 17 // create the Data Store 18 var store = Ext.create('Ext.data.Store', { 19 id: 'store', 20 pageSize: 200, 21 model: 'ForumThread', 22 remoteSort: true, 23 // allow the grid to interact with the paging scroller by buffering 24 buffered: true, 25 proxy: { 26 // load using script tags for cross domain, if the data in on the same domain as 27 // this page, an HttpProxy would be better 28 type: 'jsonp', 29 url: '/warnConsoleJson/', 30 extraParams: { 31 total: 26 32 }, 33 reader: { 34 root: 'data', 35 totalProperty: 'total' 36 }, 37 // sends single sort as multi parameter 38 simpleSortMode: true 39 }, 40 sorters: [{ 41 property: 'id', 42 direction: 'DESC' 43 }] 44 }); 45 46 var grid = Ext.create('Ext.grid.Panel', { 47 width: 700, 48 height: 500, 49 title: 'ExtJS.com - Browse Forums', 50 store: store, 51 verticalScrollerType: 'paginggridscroller', 52 loadMask: true, 53 disableSelection: true, 54 invalidateScrollerOnRefresh: false, 55 viewConfig: { 56 trackOver: false 57 }, 58 // grid columns 59 columns:[{ 60 id: 'assetNum', 61 text: "编号", 62 dataIndex: 'assetNum', 63 flex: 1, 64 sortable: false 65 },{ 66 id: 'status', 67 text: "类型", 68 dataIndex: 'status', 69 flex: 1, 70 sortable: false 71 },{ 72 id: 'sourceMsg', 73 text: "变更前", 74 dataIndex: 'sourceMsg', 75 flex: 1, 76 sortable: false 77 },{ 78 id: 'newMsg', 79 text: "变更后", 80 dataIndex: 'newMsg', 81 flex: 1, 82 sortable: false 83 },{ 84 id: 'operStatus', 85 text: "状态", 86 dataIndex: 'operStatus', 87 flex: 1, 88 sortable: false 89 },{ 90 id: 'created', 91 text: "变更时间", 92 dataIndex: 'created', 93 width: 140, 94 renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'), 95 sortable: true 96 }], 97 renderTo: Ext.getBody() 98 }); 99 100 // trigger the data store load 101 store.guaranteeRange(0, 199); 102 });