1. #1
    Sencha User
    Join Date
    Aug 2011
    Location
    Mumbai, India
    Posts
    119
    Vote Rating
    4
    Answers
    11
    Sasha172 is on a distinguished road

      0  

    Default 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 :

    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'}
    ]
    
    }
    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.

    Anything I'm obviously missing here ??

    PS : I used the sencha-touch-debug-w-comments.js file of now.

    Thanks in advance
    Sasha

  2. 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

    Code:
    {
    xtype : 'selectfield', listeners : {
    change : function(){
    Ext.get('thisFormPanel').setActiveItem('anotherPanelId'); Ext.get('thisFormPanel').setActiveItem('thisPanelId');
    }
    }
    }
    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.

    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

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    899
    Answers
    3575
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Aug 2011
    Location
    Mumbai, India
    Posts
    119
    Vote Rating
    4
    Answers
    11
    Sasha172 is on a distinguished road

      0  

    Default


    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. #4
    Sencha User
    Join Date
    Aug 2011
    Location
    Mumbai, India
    Posts
    119
    Vote Rating
    4
    Answers
    11
    Sasha172 is on a distinguished road

      0  

    Default 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

    Code:
    {
    xtype : 'selectfield', listeners : {
    change : function(){
    Ext.get('thisFormPanel').setActiveItem('anotherPanelId'); Ext.get('thisFormPanel').setActiveItem('thisPanelId');
    }
    }
    }
    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.

    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