ExtjsExt. data. I recently used the Extjs template. if you have any questions, I 'd like to ask you how to use Ext. data. store reads data from the server and does not display anything on the front-end. The following is my background code: PHPcodefunctionactionReadAllDep () {$ pageLimit Extjs Ext. data. Store usage
Hello everyone, I recently used the Extjs template and encountered a problem. I 'd like to ask you, I am using Ext. data. store reads data from the server and does not display anything on the front-end.
The following is my background code:
PHP code
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); }
The following is the front-end code:
JScript code
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'}, ['Depp _ id', 'dep_name', 'uppper _ id ', 'status'])}); var cm = new Ext. grid. columnModel ([{header: "Department No.", width: 80, dataIndex: "DEP_ID"}, {header: "Department name", width: 100, dataIndex: "DEP_NAME" },{ header: "superior department ID", width: 80, dataIndex: "UPPER_ID" },{ header: "department status", 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 ();});
------ Solution --------------------
Shi Dafu