Extjs Ext.data.Store使用问题
大家好,我最近在使用Extjs模板,遇到个问题,想请教大家,我在用Ext.data.Store读取服务器的数据,在前台显示的时候显示不出东西来,这是怎么回事。
以下是我的后台代码:
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> function actionReadAllDep() { $pageLimit = getPageLimit(); $erp = new ModelErp(); $sql = "SELECT * FROM es_dep_pro"; $dep = $erp->getList($sql,$pageLimit['form'],$pageLimit['to']); $result['totalCount'] = count($dep); $result['topics'] = $dep; require(CFG_PATH_LIB.'util/JSON.php'); $json = new Services_JSON(); echo $json->encode($result); }
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> Ext.onReady(function(){ var ds = new Ext.data.Store({ proxy : new Ext.data.HttpProxy({url:'index.php?model=erp&action=ReadAllDep&'}), reader: new Ext.data.JsonReader({ root: 'topics', totalProperty: 'totalCount' },[ 'DEP_ID','DEP_NAME','UPPER_ID','STATUS' ]) }); var cm = new Ext.grid.ColumnModel([ {header:"部门编号",width:80,dataIndex:"DEP_ID"}, {header:"部门名称",width:100,dataIndex:"DEP_NAME"}, {header:"上级部门编号",width:80,dataIndex:"UPPER_ID"}, {header:"部门状态",width:30,dataIndex:"STATUS"} ]); cm.defaultSortable = true; /*var grid = new Ext.grid.GridPanel({ region:'center', loadMask:true, store:ds, cm:cm, stripeRows:true, border:true, borderStyle:'width:100', autoScroll:true });*/ ds.load({params: {start: 0,limit: 20}}); loadend(); });