-
30 Nov 2012 8:10 AM #1
Ext.field.Select: reset()
Ext.field.Select: reset()
So I was doing some testing and it seems that the Ext.field.Select's reset method is not being properly called when you call the Ext.form.Panel's reset() method is called. It seems to call the Ext.field.Text's reset method.
Furthermore the Ext.field.Select reset method is as follows:
However if you notice this code, it's defaulting the select to be the first record if an orginalValue wasn't set. This, however, is in my opinion is incorrect, because the select might have been blank and then when the reset method is ran, it will not be set to the first item.Code:reset: function() { var store = this.getStore(), record = (this.originalValue) ? this.originalValue : store.getAt(0); if (store && record) { this.setValue(record); } return this; }
What I did was override the method to the following:
I'm not certain that this is a bug, more then I feel it's a flaw in the way the process behaves for the Ext.field.Select.Code:Ext.define('Ux.field.Select',{ override: 'Ext.field.Select', reset:function(expr){ var store = this.getStore(), record = (this.originalValue) ? this.originalValue : null; if (store && record) { this.setValue(record); } else{ this.setValue(null); } return this; } })No longer a Newbie
-
30 Nov 2012 8:48 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
When the select field is first shown, if a value was not passed, the value defaults to the first record in the store.
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.
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote