根据话题说,在添加记录之前,网格看起来异常,但在添加记录后,它再次看起来正常。代码如下:
grid = new Ext.grid.GridPanel({
id: 'grid',
store: grid_store,
width: 890,
height: 270,
readOnly: false,
autoExpandColumn: 'message_name',
columns: [{
id: 'message_name',
header: "Message Name",
width: 330,
menuDisabled: true,
align: "left",
sortable: true,
dataIndex: 'message_name'
}, {
id: 'message_value',
header: "Value",
width: 560,
menuDisabled: true,
align: "left",
sortable: true,
dataIndex: 'message_value'
}],
listeners: {
rowclick: function (grid, rowIndex, e) {
gridClicked(record.get('order'));
}
}
})
更新:固定但不确定为什么;要修复:网格位于选项卡中,当选项卡更改时,获取网格视图,然后刷新它:
var gridRefresh = function(){
if (grid && grid.getView) {
grid.getView().refresh(true);
}
}
var tabpanel = new Ext.TabPanel({
id: "tabpanel",
plain: true,
width: 950,
height: 410,
defaults: { bodyStyle: 'background-color:#DFDFDF;' },
activeTab: 0,
frame: true,
items: tabItems,
listeners: {
"tabchange": function (tabpanel, tab) {
if (tab.id == "grid_tab") { //Document Tab
grid.gridRefresh();
}
}
}
});