问题描述
初学extjs,有个问题,求助各位我的问题是单单使用extjs+struts2Ext.onReady(function(){Ext.regModel('Teams',{fields:['name','sport']});varteamStore=newExt.data.Store({model:'Teams',sorters:['sport','name'],groupField:'sport',data:[{name:'Aaron',sport:'TableTennis'},{name:'Aaron',sport:'Football'},{name:'Abe',sport:'Basketball'},{name:'Tommy',sport:'Football'},{name:'Tommy',sport:'Basketball'},{name:'Jamie',sport:'TableTennis'},{name:'Brian',sport:'Basketball'},{name:'Brian',sport:'TableTennis'}]});vargrid=newExt.grid.Panel({renderTo:Ext.getBody(),store:teamStore,width:400,height:300,title:'SportsTeams',features:[{ftype:'grouping'}],headers:[{text:'Name',flex:1,dataIndex:'name'},{text:'Sport',dataIndex:'sport'}]});});我上面的data这个一组list,如果我是后台传入的话(从action里传入)例如:privateStudentstudents;传入students这个list如何做,还有什么我写的不明白的,在线!
解决方案
解决方案二:
传一个JSON串不行吗
解决方案三:
一个可以在页面上循环生成data数组.一个使用动态加载数据