Javascript 网格不显示任何数据
这些是我关于存储和网格的配置。我通过ajax请求加载数据Javascript 网格不显示任何数据,javascript,json,ajax,extjs,grid,Javascript,Json,Ajax,Extjs,Grid,这些是我关于存储和网格的配置。我通过ajax请求加载数据 var store = new Ext.data.JsonStore({ root: 'details', fields: ['a1','a2','a3','a4','a5','a6','a7'], pruneModifiedRecords:true, autoload: fal
var store = new Ext.data.JsonStore({
root: 'details',
fields: ['a1','a2','a3','a4','a5','a6','a7'],
pruneModifiedRecords:true,
autoload: false
});
var gridDetail = new Ext.grid.Panel({
title: 'Details',
store: store,
width : '100%',
header: {
titleAlign: 'center'
},
columns: [
{ text: 'col1', dataIndex: 'a1' },
{ text: 'col2', dataIndex: 'a2'},
{ text: 'col3', dataIndex: 'a3' },
{ text: 'col4', dataIndex: 'a4' },
{ text: 'col5', dataIndex: 'a5' },
{ text: 'col6', dataIndex: 'a6' },
{ text: 'col7', dataIndex: 'a7' },
],
});
我的回报是
{success:true,first:[{…},],details:[{a1:d1,a2:d2,…a7:d7}]}
但在所有这些之后,网格上并没有显示任何内容,也并没有返回任何错误。一切正常,但网格中什么也没发生。显示遮罩,然后取消显示,但网格上未显示数据
我有什么问题,我看不见?有人能帮我吗?似乎对我很好。可能是数据格式的问题 将侦听器添加到您的存储,以检查存储获得的记录类型
尝试store.loadDataresp.details;真正的问题是:为什么要单独发出Ajax请求?就让商店来处理吧。因为@Evantimboli我不会只加载商店。我在我的请求中做了很多工作。@CD。。我昨天试过了,没用,但现在好了。非常感谢。
var getInfo= function (s1,s2,s3){
gridDetail.mask('Loading');
Ext.Ajax.request({
url : '../project/getInfo.ajax',
params :{
s1: s1,
s2: s2,
s3: s3
},
callback: function(options, success, response){
if(success){
var resp = Ext.decode(response.responseText);
gridDetail.unmask();
//some other codes not related grid
store.loadData(resp,false);
} else {
gridDetail.unmask();
Alert(resp.msj);
}
}
});
listeners:{
load: function( this, records, options ) {
console.log(records);
}
}