我是 ExtJS 的新用户,我有一个问题。
我有一家汽车商店,我创建了一个带有按钮的菜单,以按品牌或型号查看所有汽车。
现在我想显示一个带有网格面板的窗口,其中包含特定品牌/型号的所有汽车。实际上,当我创建按钮时,我会这样做:
var aCarButton = Ext.create('Ext.Button', {
text: aTextButton,
handler: function() {
var aResultWindow = new ResultWindow(aTextButton, myCarStore, 'Brand', aBrandValue);
aResultWindow.create();
}
});
aMenuPanel.add(aCarButton);
对于我的功能,我这样做:
function ResultWindow(aTitle, aStore, aFilter, aFilterValue) {
this.myTitle = aTitle;
this.myStore = aStore;
this.myFilter = aFilter;
this.myFilterValue = aFilterValue;
this.myStore.filter(aFilter, aFilterValue);
}
ResultWindow.prototype.create = function() {
var grid = Ext.create('Ext.grid.Panel', {
store: this.myStore,
columns: [
...
]
});
var window = Ext.create('Ext.window.Window', {
layout: 'fit',
maximizable: true,
title: this.myTitle,
items: [ grid ],
width: 1024,
height: 768
});
window.show();
}
首先,我不确定这是展示我想要的东西的最佳方式。
其次,我有一个按钮可以显示所有汽车(无过滤器),但需要大约 2 分钟才能显示我所有的 12000 条记录。
所以我的第一个问题是知道我显示我想要的内容的解决方案是否正确?
我的第二个问题是否可以更快地显示所有汽车?
PS:如果我犯了一些错误,对不起我的英语。