Results 1 to 3 of 3

Thread: Combobox items disappears after adding to the store

  1. #1
    Sencha User
    Join Date
    Aug 2012
    Posts
    7
    Vote Rating
    0
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3932
    Vote Rating
    1272
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Aug 2012
    Posts
    7
    Vote Rating
    0
      0  

    Default

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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •