-
15 Apr 2011 1:29 PM #1
[OPEN-EXTJSIV-1638][4.0.1] ComboBox Initial Value
[OPEN-EXTJSIV-1638][4.0.1] ComboBox Initial Value
Setting the "value" is being ignored as the initial item to show in the combo. Instead we just see a blank area or if emptyText is set we get that.
Typically you can set the value to a store ID or the Text value of one of the store items.
-
15 Apr 2011 4:05 PM #2
Please post a short test case that demonstrates the issue.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
16 Apr 2011 12:34 AM #3
I posted the same issue yesterday:
So the form I'm using is getting set from another (grid) view:I have some dialogs with comboBoxes. These combo boxes are loaded from a datastore (defined as local, butting getting data from an ajax call). In previous releases when I load the dialog, the value of the selected item is set to the combo, and the combo then displays the previous selection. Now it sometimes does this, but sometimes it shows a blank combo, but as soon as I click on it it jumps to the selected item and considers it selected.
Am I doing something wrong in handling this, or has something changed that affects this?
This properly fetches all the data and sets it in the following form, however, for some combo's the selected value is selected, for others it is not. So it seems to be a case of 'order in which things are processed', or an event trigger not being handled.Code:this.siteDetails = Ext.create( 'widget.sitedetails' ); this.siteDetails.load( { url: 'api/sites/load/', params: { f_site_id: site_id } } );
The combo box is set as follows:
where 'f_site_type_id' is the id loaded by the 'api/sites/load/' call.Code:var siteTypeCombo = new Ext.form.ComboBox({ fieldLabel: 'Select a site type', labelStyle: 'font-weight:bold', name: 'f_site_type_id', id: 'sitetypecombo', allowBlank: false, editable: false, queryMode: 'local', displayField: 'f_popup_option_name', valueField: 'f_popup_option_id', store: new Ext.data.Store({ model: 'TYPE_PopupOption', autoLoad: true, proxy: { type: 'ajax', url: 'api/popup_options/family/site_type', reader: { type: 'json', root: 'data' } } }) });
-
16 Apr 2011 12:55 AM #4
Here's my Config
jsonCode:Ext.onReady(function(){ Ext.regModel('CompanyList', { fields: [ {name: 'companyid', type: 'int'}, {name: 'companyname', type: 'string'} ] }); var store = new Ext.data.Store({ model: 'CompanyList', proxy: { type: 'ajax', url : '/pages/company_combo.cfm', reader: { type: 'json', root: 'data' } } }); store.load(); var combobox = Ext.create('Ext.form.ComboBox', { id: 'companyCombo', store: store, queryMode: 'local', displayField: 'companyname', valueField:'companyid', submitEmptyText: false, hiddenValue: 0, value: 0, hiddenName: 'companyid', editable: false, forceSelection: true, triggerAction: 'all', }); var accordionPanel = new Ext.Panel({ title: 'Panel', id: 'panel001', autoScroll: false, hidden: false, border: 0, layout: 'fit', items:[ combobox ] }); var myAccordion = Ext.create('Ext.panel.Panel', { region: 'center', id: 'myPanelId', border: 0, items: [ accordionPanel ] }); Ext.create('Ext.Viewport', { id: 'testing', layout: { type: 'fit' }, items: [ myAccordion ] }); });
Code:{ success:true, data:[ { "companyid" : "0", "companyname" : "Default Company" }, { "companyid" : "5", "companyname" : "Test company" } , { "companyid" : "1", "companyname" : "ACME" } , { "companyid" : "4", "companyname" : "Another Company XYZ" } , { "companyid" : "3", "companyname" : "Test company 2" } ] }
-
16 Apr 2011 2:12 AM #5
could it be a type issue? value: 0 is not the same as value: "0"
in your data store it would expect "0" not 0
-
16 Apr 2011 2:17 AM #6
-
26 Apr 2011 9:00 AM #7
Issue is still present in 4.0.0
-
19 May 2011 10:34 AM #8
@Devteam
Issue is still present in 4.0.1
-
22 May 2011 10:08 AM #9
Hi guys,
I've just found the same issue. Instead of posting sample code I can post code from ExtJS 4.0.1 itself.
Ext.form.field.ComboBox:
Notice comment: 'Ensure it is processed by the onLoad'Code:if (me.store.loading) { // Called while the Store is loading. Ensure it is processed by the onLoad method. me.value = value; return me; }
And onLoad listing:
Here's my code from ext-fix.js I have for such stuff:Code:onLoad: function() { var me = this, value = me.value; me.syncSelection(); if (me.picker && !me.picker.getSelectionModel().hasSelection()) { me.doAutoSelect(); } },
It works perfectly well for me so far, so I guess you just need to implement that processing on your own.Code:Ext.override(Ext.form.field.ComboBox, { onLoad: function() { this.callOverridden(); this.setValue(this.value); } });
-
22 May 2011 11:07 AM #10
Thank you for reporting this bug. We will make it our priority to review this report.
Similar Threads
-
[OPEN-EXTJSIV-413] ComboBox.getValue() does not return value of the field
By sidamos77 in forum Ext:BugsReplies: 2Last Post: 28 Mar 2011, 6:26 AM -
[OPEN-EXTJSIV-195] combobox error: me.dom.className is undefined
By oaugustus in forum Ext:BugsReplies: 1Last Post: 21 Mar 2011, 7:30 AM -
[OPEN-EXTJSIV-196] change and keypress events do not fire for ComboBox
By sidamos77 in forum Ext:BugsReplies: 0Last Post: 21 Mar 2011, 5:56 AM -
[OPEN-EXTJSIV-203] API Docs: ComboBox
By PV-Patrick in forum Ext:BugsReplies: 0Last Post: 21 Mar 2011, 12:41 AM -
[OPEN] [OPEN-EXTJSIV-210] ComboBox Validation
By PV-Patrick in forum Ext:BugsReplies: 0Last Post: 19 Mar 2011, 5:12 PM


Reply With Quote

