Home >Web Front-end >JS Tutorial >ExtJS4 sets the default value in the Combobox list example_extjs

ExtJS4 sets the default value in the Combobox list example_extjs

WBOY
WBOYOriginal
2016-05-16 16:50:221527browse

This is model

Copy code The code is as follows:

Ext.regModel('commemModel', {
fields : [ 'name', 'id' ]
});

Define a store and set the default value of the container with id as s1 to the first quarter
Copy code The code is as follows:

var gjcx1 = new Ext.data.Store({
autoLoad:true ,
model : commemModel,
proxy : {
type : 'ajax',
url : '../store/cxjd.json'

},
listeners :{
load:function(){
Ext.getCmp('s1').setValue('q1');
}
}

});

The cxjd.json is given below
Copy code The code is as follows:

[
{name:'First Quarter',id:'q1'},
{name:'Second Quarter',id:'q2'},
{name:'Third Quarter' ,id:'q3'},
{name:'Q4',id:'q4'}
]
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