1. #1
    Sencha User
    Join Date
    Aug 2012
    Posts
    7
    Vote Rating
    0
    Leprosy is on a distinguished road

      0  

    Default Unanswered: Combobox items disappears after adding to the store

    Unanswered: Combobox items disappears after adding to the store


    Perhaps a noob question...I have the following code:
    Code:
    L = Ext.getCmp('combobox1');
    L.store.removeAll();
    L.store.addListener('datachanged', function(){console.log('datachanged')});
    for (i in data) {
        L.store.add({text: data[i].text})
    }

    The combobox is rendered already and is empty. The code is meant to populate them with items(stored previously in data). After I click the combobox, the items are gone(the datachanged event is fired, verified by the addListener method applied before). Before the click, the store contains all the items(verified this by logging the L.store.data.items object ).

    Thanks in advance!

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,327
    Answers
    3540
    Vote Rating
    850
    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


    First thing that jumps out at me is instead of executing store.add for however many items are in data, why not build an array and execute store.add once?
    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.

  3. #3
    Sencha User
    Join Date
    Aug 2012
    Posts
    7
    Vote Rating
    0
    Leprosy is on a distinguished road

      0  

    Default


    Sounds fine for an optimization in the algorithm, but what would be the difference in expected functionality?

Thread Participants: 1

Tags for this Thread