1. #1
    Sencha User chalu's Avatar
    Join Date
    Feb 2008
    Location
    Benin City, Nigeria
    Posts
    480
    Vote Rating
    1
    chalu is on a distinguished road

      0  

    Default How To Select Item In A Combo Then Trigger Load Or Select In Another Combo ??

    How To Select Item In A Combo Then Trigger Load Or Select In Another Combo ??


    Hello great guys, please I need help doing "linked" combos, I need to be able to select an item in a combo (say country combo) such that the selection will trigger a "corresponding" load operation or (or a filter operation if already loaded) in another combo (say the states combo), the second combo needs to load (or filter) values based on what was selected in the first combo. Any hints ??
    Code:
            ComboBox<BeanModel> loanType = new ComboBox<BeanModel>();
            loanType.setName("type");
            loanType.setEmptyText("");
            loanType.setValueField("id");
            loanType.setAllowBlank(false);
            loanType.setDisplayField("name");
            loanType.setForceSelection(true);
            loanType.setFieldLabel("Loan Type");
            loanType.setTriggerAction(ComboBox.TriggerAction.ALL);        
            loanType.setStore((ListStore<BeanModel>) Registry.get(DataCenter.LOANTYPE_LIST_STORE));
            entryForm.add(loanType, new FormData("55%"));
    
            final ComboBox<BeanModel> client = new ComboBox<BeanModel>();
            client.setName("client");
            client.setEmptyText("");
            client.setValueField("id");
            client.setAllowBlank(false);
            client.setDisplayField("fullname");
            client.setForceSelection(true);
            client.setFieldLabel("Client");
            client.setTriggerAction(ComboBox.TriggerAction.ALL);
            client.setStore((ListStore<BeanModel>) Registry.get(DataCenter.CLIENT_LIST_STORE));
            loanType.addSelectionChangedListener(new SelectionChangedListener<BeanModel>() {
                @Override
                public void selectionChanged(SelectionChangedEvent<BeanModel> se) {               
                    // here I need to load the "client" combo passing loanTtype.getId() as a parameter
                    // or if already loaded, I'll like to filter the "client" combo based on loanTtype.getId()
                }
            });
            entryForm.add(client, new FormData("55%"));
    By the way, how can one tell if a combo's store is loaded ??

  2. #2
    Sencha User chalu's Avatar
    Join Date
    Feb 2008
    Location
    Benin City, Nigeria
    Posts
    480
    Vote Rating
    1
    chalu is on a distinguished road

      0  

    Default


    Please any hints on this ...

  3. #3
    Ext User
    Join Date
    May 2010
    Posts
    58
    Vote Rating
    0
    hiinsu is on a distinguished road

      0  

    Default


    Hi, I'm not familiar with combo box but I do know that you can listen to loader.load or store.datachanged to tell if the data is loaded.
    if you listen to loader.load, you need to check for error cases.
    if you listen to store.datachaged your dont have to check for error cases because this can't catch loader / loading error

Similar Threads

  1. How load auto select with combo box?
    By RyanZec in forum Ext 2.x: Help & Discussion
    Replies: 9
    Last Post: 11 Apr 2012, 5:17 AM
  2. (Newbie) Remote load combo options and select an item
    By ziggurat in forum Ext 2.x: Help & Discussion
    Replies: 11
    Last Post: 26 Dec 2011, 12:55 AM
  3. Combo select item
    By ttony in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 11 Mar 2008, 11:24 AM

Thread Participants: 1