【发布时间】:2012-06-23 02:51:57
【问题描述】:
我的页面现在加载速度非常慢。基本上,我想预先填充我拥有的组合框。现在,它单独预填充每个,然后选择默认值。这太慢了。在页面完全加载之前,用户将需要等待大约一分钟。
我正在获取值以从服务器填充组合框。预先选择组合框值的值通过响应变量在数组中接收。如何加快整个过程?
代码如下:
EXTJS
xtype: "combo",
width: 250,
id: "nameId",
name: "comboName",
labelStyle: 'width:100px',
fieldLabel:"Name",
allowBlank: true,
displayField: "nameDisplay",
valueField: "nameValue",
url: "/thelink/toGetAllComboboxValues/fromPHPFile/",
return {
init: function (args) {
formPanel.on({
beforerender: function () {
Ext.Ajax.request({
url: 'url/to/another/PHP/file/',
scope: this,
method: 'GET',
params: {
code_id: 'myUser',
number: '12345'
},
success: function (response, opts) {
var result = Ext.decode(response.responseText);
Ext.getCmp('nameId').setValue(result.Name);
},
});
},
scope: this
});
//add form panel here
},
getFormPanel: function () {
return formPanel;
},
// load parameter values into the form
loadParams: function () {
},
goHome: function () {
},
};
}();
获取组合框值的 PHP
//makes call to server for each individual combo box values
获取预选值的 PHP
//grabs all pre-selected values based on an ID and puts them in an array
【问题讨论】:
-
您使用的是哪个版本的 Extjs(直到次要版本,例如:4.1.0)?另外,这些商店中有多少条记录?回答这些问题确实有助于我们更详细地了解您的情况。