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

WBOY
Release: 2016-06-13 13:50:01
Original
882 people have browsed it

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);
    }

Copy after login


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

Copy after login


------解决方案--------------------
士大夫
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!