1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    3
    Vote Rating
    0
    caspar.jes is on a distinguished road

      0  

    Default Clearing data list in a ComboBox

    Clearing data list in a ComboBox


    Hello,

    I have two ComboBoxes in a FormPanel, both using a JsonStore. Let's set it up:

    CB1: A list of folders
    CB2: A list of users in the selected folder

    As of now, when CB1 changes I update and reload the JsonStore behind CB2. This works fine. However - if I change CB1 and press CB2 to show the users in the drop-down, then change CB1 again and want to see users again, the old users are still being shown. If I search for a query or anything (I have typeAhead=true), it loads with the correct data set, but I can't get it to clear that default data set?

    I could not find any clearData or the like in Ext.form.ComboBox. Can anyone help me out on this one?

  2. #2
    Sencha User
    Join Date
    Jan 2011
    Posts
    541
    Vote Rating
    50
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default


    You simply want to remove all records from the store CB2 uses, before then loading in the new data

    CB2.getStore().removeAll();

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    3
    Vote Rating
    0
    caspar.jes is on a distinguished road

      0  

    Default


    Quote Originally Posted by willigogs View Post
    You simply want to remove all records from the store CB2 uses, before then loading in the new data

    CB2.getStore().removeAll();
    I'm already doing so:
    Code:
    var payer = this.form.getForm().findField("payer");
    payer.storeParams.folder_id = id;
    payer.setValue('');
    payer.getStore().removeAll();
    payer.getStore().setBaseParam('folder_id', id);
    payer.getStore().reload();
    Not working.

  4. #4
    Sencha User
    Join Date
    Jan 2011
    Posts
    541
    Vote Rating
    50
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default


    Hmm, strange.

    Removing the records from the store (as you're already attempting) is definitely the correct method, so I wonder if it's something to do with the order in which the events are firing and being acted upon. For the store to reload and retain the existing data also makes me think the previous store params are perhaps not being cleared?

    If you could provide any example of your code then I'd happily take a look, but the first steps I would be taking is to debug the store, by console.logging it on each load, clear, etc - and double checking which parameters are being passed to the store during these events.

  5. #5
    Sencha User
    Join Date
    Apr 2012
    Posts
    3
    Vote Rating
    0
    caspar.jes is on a distinguished road

      0  

    Default


    Quote Originally Posted by willigogs View Post
    Hmm, strange.

    Removing the records from the store (as you're already attempting) is definitely the correct method, so I wonder if it's something to do with the order in which the events are firing and being acted upon. For the store to reload and retain the existing data also makes me think the previous store params are perhaps not being cleared?

    If you could provide any example of your code then I'd happily take a look, but the first steps I would be taking is to debug the store, by console.logging it on each load, clear, etc - and double checking which parameters are being passed to the store during these events.
    The thing is. The store params are changed and saved, but the list dropdown-list in the ComboBox is not being cleared when reloading the JsonStore - so if I just press the arrow to show the dropdown-list, the previous set of data is shown by default, but if I search or anything (to force a new request), the correct set of data is used. This seems to me as if the store params are properly passed on.

  6. #6
    Sencha User
    Join Date
    Jan 2011
    Posts
    541
    Vote Rating
    50
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default


    Without a code snippet it's unfortunately hard to debug what exactly could be going wrong here

    Do you have triggerAction: 'all' assigned to your combobox? That's one possible cause for combos only submitting when typing into them, rather than during clicks also...

    I'd also take a look at exactly when the combo events are firing. For example "Change" only fires once the combo blurs - which isn't always the preferred event and when actually clicking the combo to select a value. If this is the case, you might instead want to fire the reloading of your second store earlier by using the "Select" event instead.

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar