-
15 Mar 2012 4:27 AM #1
Unanswered: How can I display combobox text after form load?
Unanswered: How can I display combobox text after form load?
I can post the value of remote combobox with hiddenName. I couldn't accomplish showing the text of combobox after form load. This is a remote combo. So the store is not loaded after form load. So the combo only shows the value field...
config for combobox
apart from form's configCode:Ext.ns('portal', 'portal.common'); portal.common.store_combo_company = new Ext.data.JsonStore({ root: 'data', url: '../common/presentation/commondata.aspx', baseParams: { cmd: 'combo_company' }, fields: [{ name: 'ParamID', type: 'int' }, { name: 'ParamDescription', type: 'string' }] }); portal.common.ComboCompany = Ext.extend(Ext.form.ComboBox, { constructor: function(config) { config = Ext.apply({ store: portal.common.store_combo_company, valueField: 'ParamID', displayField: 'ParamDescription', fieldLabel: 'Firma', mode: 'remote', typeAhead: false, triggerAction: 'query', minChars: 2 }, config); portal.common.ComboCompany.superclass.constructor.call(this, config); } }); Ext.reg('combocompany', portal.common.ComboCompany);
Code:{ id: 'form_contract', url: 'prcdata.aspx', xtype: 'form', baseCls: 'x-plain', labelWidth: 120, bodyStyle: 'padding:10px', defaults: { anchor: '100%', xtype: 'textfield' }, items: [{ fieldLabel: 'contractId', name: 'contractId', xtype: 'hidden' }, { id: 'prc_firma', xtype: 'combocompany', emptyText: 'Seçiniz', hiddenName: 'Firma' }] }
-
15 Mar 2012 10:35 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,641
- Vote Rating
- 434
- Answers
- 3107
If the store hasn't finished loading when you set a value to the combo then you will need to reset the value once the store has finished loading.
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 10:35 PM #3
the combo retrieves 5000 rows. so i don't want to load these rows in form load... what i wanted to make is displaying combo value and text without loading combo store...
-
16 Mar 2012 1:15 AM #4Ext JS Premium Member
- Join Date
- Jan 2008
- Location
- Germany, Berlin
- Posts
- 123
- Vote Rating
- 7
- Answers
- 18
You could use setRawValue to simply display the value you want.
I usally use a combination of setValue & setRawValue. So the combobox IS aware of the to-be-used-value and correctly transmits the value but without loading the store...
HTH
Florian
-
16 Mar 2012 1:43 AM #5
thank you @fschaeffer,
setRawValue worked very well.
But it is extra code to implement this common requirement.. I think this must be functionality of combo component. An additional config item like loadValue which will bind the action.result.data.<data_item> to combobox RawValue could be easily implemented.. so we didn't have to write extra code..


Reply With Quote