1. #1
    Ext User
    Join Date
    Dec 2010
    Posts
    1
    Vote Rating
    0
    banbaal is on a distinguished road

      0  

    Wink TreeComboBox example

    TreeComboBox example


    Here is a tree combobox combining StoreFilterField and TreeGrid. it allows using grid features like grouping rowNumberer multiple column etc. contstructor takes columnModel code example below

    Code:
    UComboBox<CustomerTypeDTO> parentTypeComboBox;
    List<ColumnConfig> configs = new ArrayList<ColumnConfig>(2);
    ColumnConfig config = new ColumnConfig("customerTypeCode", "Code", 80);
    configs.add(config);
    config = new ColumnConfig("customerTypeName", "Name", 120);
    configs.add(config);
    parentTypeComboBox = new UComboBox<CustomerTypeDTO>(new ColumnModel(configs));
    parentTypeComboBox.setDisplayField("customerTypeCode");
    parentTypeComboBox.setForceSelection(true);
    
    RpcProxy<ArrayList> proxy = new RpcProxy<ArrayList>() {
                @Override
                protected void load(Object loadConfig, AsyncCallback<ArrayList> asyncCallback) {
                    if (loadConfig == null) {
                        EntityManagerRPC.App.getInstance().executeQuery(new           Query("CustomerType.findParents").setParameter("inactive", false), asyncCallback);
                        return;
                    }
                    EntityManagerRPC.App.getInstance().executeQuery(new Query("CustomerType.findByParent").setParameter("parentId", ((CustomerTypeDTO) loadConfig).getCustomerTypeId()).setParameter("inactive", false), asyncCallback);
                }
            };
            TreeLoader<CustomerTypeDTO> loader = new BaseTreeLoader<CustomerTypeDTO>(proxy) {
                @Override
                public boolean hasChildren(CustomerTypeDTO parent) {
                    return true;
                }
            };
            TreeStore<CustomerTypeDTO> store = new TreeStore<CustomerTypeDTO>(loader);
            parentTypeComboBox.setTreeStore(store);
    
    parentTypeComboBox.addSelectionChangedListener(new SelectionChangedListener<CustomerTypeDTO>() {
                @Override
                public void selectionChanged(SelectionChangedEvent<CustomerTypeDTO> se) {
                    if (se.getSelectedItem() != null)
                        parentNameTextField.setValue(se.getSelectedItem().getCustomerTypeName());
                }
            });
    
    parentTypeComboBox.setSelectedItem(updatingDTO.getParentCustomerType());
    dto.setParentCustomerType(parentTypeComboBox.getSelectedItem());
    Screenshot.png
    Attached Files

  2. #2
    Sencha User
    Join Date
    Mar 2010
    Posts
    1
    Vote Rating
    0
    nasanjargal.b is on a distinguished road

      0  

    Default hi

    hi


    it's very nice.

Similar Threads

  1. Seeking TreeComboBox example with JsonStore
    By akrherz in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 29 Oct 2009, 5:25 AM

Thread Participants: 1

Tags for this Thread