Home >Web Front-end >JS Tutorial >Implementation method of loading and assigning initial value to ComboBox in Extjs_extjs

Implementation method of loading and assigning initial value to ComboBox in Extjs_extjs

WBOY
WBOYOriginal
2016-05-16 17:55:051204browse

For example:

Copy code The code is as follows:

editCityStore.load({ params: { provinceID: proid });
Ext.getCmp('city-id-name').setValue(cityid);

Since the store is loaded asynchronously, it will assign the value first and then fill in the value To ComboBox, you need to use here:

Assign value after loading is complete:
Copy code Code As follows:

editCityStore.load({

params: { provinceID: proid },

callback: function () {
//Waiting for data to load The value is assigned only after completion, otherwise due to asynchronous operation, the value will be assigned first and then loaded.
Ext.getCmp('city-id-name').setValue(cityid);
},
scope: editCityStore,/ /Indicates the scope
add: false //false means the data is not accumulated
});
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn