-
13 Mar 2012 5:50 PM #1
If ComboBox's valueField is int type field, It will not work properly.
If ComboBox's valueField is int type field, It will not work properly.
var themeStore = Ext.create('Ext.data.Store', {
fields: ['value', 'name'],
data: [
{ value: 0, name: "default" },
{ value: 1, name: "access" },
{ value: 2, name: "gray" },
{ value: 3, name: "scoped" }]
});
var languageStore = Ext.create('Ext.data.Store', {
fields: ['value', 'name'],
data: [
{ value: "en", name: "English" },
{ value: "zh", name: "Chinese"}]
});
items: [{
xtype: 'combobox',
name: 'Language',
queryMode: 'local',
maxLength: 16,
fieldLabel: 'Language',
displayField: 'name',
valueField: 'value',
//value: 'en',
editable: false,
store: languageStore
}, {
xtype: 'combobox',
name: 'Theme',
queryMode: 'local',
maxLength: 16,
fieldLabel: 'Theme',
displayField: 'name',
valueField: 'value',
value: 0,
editable: false,
store: themeStore
}]
form.findField('Language').select('en');
form.findField('Theme').select(0);
As below
noname.png
-
14 Mar 2012 11:56 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,641
- Vote Rating
- 434
You shouldn't need to use the select method. This works as expected:
Code:var themeStore = Ext.create('Ext.data.Store', { fields: ['value', 'name'], data: [ { value: 0, name: "default" }, { value: 1, name: "access" }, { value: 2, name: "gray" }, { value: 3, name: "scoped" }] }); var languageStore = Ext.create('Ext.data.Store', { fields: ['value', 'name'], data: [ { value: "en", name: "English" }, { value: "zh", name: "Chinese"}] }); new Ext.panel.Panel({ renderTo : document.body, width : 400, height : 400, title : 'Test', items : [ { xtype : 'combobox', name: 'Language', queryMode: 'local', maxLength: 16, fieldLabel: 'Language', displayField: 'name', valueField: 'value', value: 'en', editable: false, store: languageStore }, { xtype: 'combobox', name: 'Theme', queryMode: 'local', maxLength: 16, fieldLabel: 'Theme', displayField: 'name', valueField: 'value', value: 0, editable: false, store: themeStore } ] });Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
15 Mar 2012 1:00 PM #3
OH, my god
OH, my god
I'm sure used the select method.
form.findField('Language').select('en');
form.findField('Theme').select(0);
But, I can notget the righteffect by select(0).
Looks like we can't reproduce the issue or there's a problem in the test case provided.


Reply With Quote