嗨,这是我的代码我试图刷新网格面板单击工具栏中的刷新按钮,但它不会再工作或什么都没有发生,请你帮我什么是正确的语法?如何刷新/重新加载网格
var store = new Ext.data.JsonStore({
url: 'data-cloud.php',
fields: [{
name: 'userid'
}, {
name: 'record_name'
}, {
name: 'search_term',
type: 'string'
}]
});
var grid_array = new Array();
store.load({
params: {
start: 0,
limit: 5
}
});
store.on('load', function(store, records) {
for (var j = 0; j < records.length; j++) {
grid_array[j] = records[j].get('record_name');
}
});
// create the Grid
var datagrid = new Ext.grid.GridPanel({
store: store,
columns: [{
id: 'id',
header: 'Cloud Name',
width: 155,
renderer: record_name,
sortable: true,
dataIndex: 'record_name'
}, {
header: 'Search Term',
width: 150,
sortable: true,
dataIndex: 'search_term'
}],
stripeRows: true,
height: 250,
width: 500,
id: 'cloud_panel',
title: 'DB Grid',
id: 'detailPanel',
tbar: [{
text: 'Refresh',
iconCls: 'new-topic',
handler: function() {
Ext.getCmp('detailPanel').getView().refresh();
}
}
],
bbar: new Ext.PagingToolbar({
pageSize: 5,
store: store,
displayInfo: true,
displayMsg: 'Displaying topics {0} - {1} of {2}',
emptyMsg: "No topics to display"
})
});
我用你的代码,它会在长期载入控制台显示错误行GET HTTP: //192.168.1.2/ext/undefined :( – VSN
我也用过这个Ext.getCmp('cloud_panel').load('data-cloud.php');之后它直接tly在网格中打印数组而不是actaul值。 :( – VSN
也谢谢你也!我的问题解决了..通过Ext.getCmp('cloud_panel')。getStore()。reload(); – VSN