Home > Web Front-end > JS Tutorial > body text

ExtJS4 sets the default value in the Combobox list example_extjs

WBOY
Release: 2016-05-16 16:50:22
Original
1489 people have browsed it

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'}
]
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!