-
30 Aug 2012 6:44 AM #1
Answered: SelectField's DisplayField is not updating on selection change
Answered: SelectField's DisplayField is not updating on selection change
Hi,
So this is a problem in both the iPhone & iPad. When I click on a selectfield, the picker shows up. I change the selection, but the displayField doesn't update. It remains selected to the same value it was before.
Here's the code :
The "change" event is firing in the listeners, and any functions that use the value from this field seem to be working. But the display just doesn't update.Code:{ xtype: 'selectfield', name : 'defaultVal', id : 'defaultVal', valueField : 'value', displayField : 'text', label: 'Show For...', options: [ {text: 'Today', value: 'today'}, {text: 'Last Week', value: 7}, {text: 'Last Two Weeks', value: 14}, {text: 'This Month', value: 30}, {text: 'Last Two Months', value: 60}, {text: 'Last Three Months', value: 90}, {text: 'From...', value: 'custom'} ] }
Anything I'm obviously missing here ??
PS : I used the sencha-touch-debug-w-comments.js file of now.
Thanks in advance
Sasha
-
Best Answer Posted by Sasha172
Hi,
So still not sure what was causing the error. However, I noticed, that during the switch between panels (using animation), the displayField would update with the correct selected values.
So my dirty workaround is basically updating the lines in red in the change event
Basically, although the user can't see it (atleast they can't see it on the iOS devices, not sure about Android render speeds), the panel switch (almost unnoticeably) and the value updates itself. The screen sort of blinks once for a millisecond.Code:{xtype : 'selectfield', listeners : {change : function(){Ext.get('thisFormPanel').setActiveItem('anotherPanelId'); Ext.get('thisFormPanel').setActiveItem('thisPanelId');}}}
I know this is a dirty workaround. And I'd be thrilled if anyone figures out the actual reason behind this or the solution. But for now my work can continue.
Cheers
Sasha
-
1 Sep 2012 7:01 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
- Answers
- 3157
Set a breakpoint in the select field to see what's going wrong. Most likely its due to not being able to find the record via the value.
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.
-
4 Sep 2012 11:55 PM #3
I set breakpoints. Doesn't seem to be helping.
What do you mean by can't find the record ? The change event registers the "newValue" properly.
-
5 Sep 2012 1:00 AM #4
Dirty Workaround
Dirty Workaround
Hi,
So still not sure what was causing the error. However, I noticed, that during the switch between panels (using animation), the displayField would update with the correct selected values.
So my dirty workaround is basically updating the lines in red in the change event
Basically, although the user can't see it (atleast they can't see it on the iOS devices, not sure about Android render speeds), the panel switch (almost unnoticeably) and the value updates itself. The screen sort of blinks once for a millisecond.Code:{xtype : 'selectfield', listeners : {change : function(){Ext.get('thisFormPanel').setActiveItem('anotherPanelId'); Ext.get('thisFormPanel').setActiveItem('thisPanelId');}}}
I know this is a dirty workaround. And I'd be thrilled if anyone figures out the actual reason behind this or the solution. But for now my work can continue.
Cheers
Sasha


Reply With Quote