Home  >  Article  >  Backend Development  >  Extjs Ext.data.Store使用有关问题

Extjs Ext.data.Store使用有关问题

WBOY
WBOYOriginal
2016-06-13 09:59:291058browse

Extjs Ext.data.Store使用问题
大家好,我最近在使用Extjs模板,遇到个问题,想请教大家,我在用Ext.data.Store读取服务器的数据,在前台显示的时候显示不出东西来,这是怎么回事。
以下是我的后台代码:

PHP code
<!--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);    }


以下是前台代码:
JScript code
<!--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();    });


------解决方案--------------------
士大夫
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn