Extjs Don';t加载网格。PHP
有人会帮我写这样的代码:网格不加载信息。 下面是我正在使用的代码,但网格中没有任何信息。 Extjs php下面是带有json代码的代码Extjs Don';t加载网格。PHP,php,json,extjs,Php,Json,Extjs,有人会帮我写这样的代码:网格不加载信息。 下面是我正在使用的代码,但网格中没有任何信息。 Extjs php下面是带有json代码的代码 <?php print '{ "total": 10, "country": [ { "name": "CULTIV", "area": "6.96120082466223e-007" }, { "name": "as
<?php
print '{
"total": 10,
"country": [
{
"name": "CULTIV",
"area": "6.96120082466223e-007"
},
{
"name": "asdASdasd",
"area": "123123123"
}
]
}';
?>
我认为您需要将商店的
自动加载配置设置为true。如果未设置此属性,则需要调用存储的load()
方法
选项1
var store = new Ext.data.JsonStore({
// store configs
storeId: 'myStore',
autoLoad:true,
proxy: {
type: 'ajax',
url: 'data.php',
reader: {
type: 'json',
root: 'country'
//idProperty: 'total'
}
},
//alternatively, a Ext.data.Model name can be given (see Ext.data.Store for an example)
fields: ['name', 'area']
});
选项2
var store = new Ext.data.JsonStore({
// store configs
storeId: 'myStore',
proxy: {
type: 'ajax',
url: 'data.php',
reader: {
type: 'json',
root: 'country'
//idProperty: 'total'
}
},
//alternatively, a Ext.data.Model name can be given (see Ext.data.Store for an example)
fields: ['name', 'area']
});
store.load();
你需要打电话到商店的load
来完善我的朋友Great Thnk,寻求帮助。
var store = new Ext.data.JsonStore({
// store configs
storeId: 'myStore',
proxy: {
type: 'ajax',
url: 'data.php',
reader: {
type: 'json',
root: 'country'
//idProperty: 'total'
}
},
//alternatively, a Ext.data.Model name can be given (see Ext.data.Store for an example)
fields: ['name', 'area']
});
store.load();