Hybrid View

  1. #1
    Sencha User
    Join Date
    Aug 2012
    Posts
    6
    Vote Rating
    0
    pokarjm@gmail.com is on a distinguished road

      0  

    Default Unanswered: SimpleCoboBox inside EditorGrid not displaying initial Value

    Unanswered: SimpleCoboBox inside EditorGrid not displaying initial Value


    I am not getting the initial Value for Light Column and after clicking and selecting only it starts displaying.

    also, for column account Name, I am not able to make it display as String. where I am going wrong.sendhaDoubt.PNG

    Code:
            final SimpleComboBox<String> comv = new SimpleComboBox<String>();
             comv.setSimpleValue("Shade");
                comv.setForceSelection(true);
                comv.setTriggerAction(TriggerAction.ALL);
                comv.add("Shade");
                comv.add("Mostly Shady");
                comv.add("Sun or Shade");
                comv.add("Mostly Sunny");
                comv.add("Sunny");
    
    
                CellEditor editor1 = new CellEditor(comv) {
                  @Override
                  public Object preProcessValue(Object value) {
                    if (value == null) {
                      return value;
                    }
                    return comv.findModel(value.toString());
                  }
    
    
                  @Override
                  public Object postProcessValue(Object value) {
                    if (value == null) {
                      return value;
                    }
                    return ((ModelData) value).get("value");
                  }
                };
    
    
                ColumnConfig column1 = new ColumnConfig();
                column1.setId("light");
                column1.setHeader("Light");
                column1.setWidth(130);
                column1.setEditor(editor1);
                configs.add(column1);
                
            
            
            
            List<RoleDTO> listRoleDto = response.getListRoleDto();
            List<String> listOfRoleName = new ArrayList<String>();
        
            for (int i = 0; i < listRoleDto.size(); i++) {
                RoleDTO roleDto=listRoleDto.get(i);
                listOfRoleName.add(roleDto.getRoleName());
            }
    
    
            final SimpleComboBox<String> combo = new SimpleComboBox<String>();
            combo.setForceSelection(true);
            combo.setTriggerAction(TriggerAction.ALL);
            combo.add(listOfRoleName);
            
            CellEditor editor2 = new CellEditor(combo) {
                  @Override
                  public Object preProcessValue(Object value) {
                      
                      System.out.println(".preProcessValue()" +value);
                    if (value == null) {
                      return value;
                    }
                    return combo.findModel(value.toString());
                  }
    
    
                  @Override
                  public Object postProcessValue(Object value) {
                      System.out.println(".postProcessValue() "+value);
                    if (value == null) {
                      return value;
                    }
                    System.out.println(((ModelData) value).get(UserResult.ROLE_NAME));
                    return ((ModelData) value).get("value");
                  }
                };
    
    
            ColumnConfig statusColumn = new ColumnConfig();
            statusColumn.setId(UserResult.ROLE_NAME);
        //    statusColumn.setRenderer(getRoleNameRenderer());
            statusColumn.setEditor(editor2);
            statusColumn.setWidth(140);
            statusColumn.setHeader(Constants.VU_ROLE);
            configs.add(statusColumn);
    
    
    
    
    
    
            
            
            List<AccountDTO> listAccountDto = response.getListOfAccountDto();
    
    
            List<ModelData> listModeldata=getModelData(listAccountDto);
            List<String> listOfAccountName = new ArrayList<String>();
        
            for (int i = 0; i < listAccountDto.size(); i++) {
                AccountDTO accountDto=listAccountDto.get(i);
                listOfAccountName.add(accountDto.getAccountName());
            }
    
    
            MultiSelectComboBox multiSelectComboBox = getMultiSelectComboBox(null, "123", 150, "label", listModeldata);
            
            CellEditor editor3 = new CellEditor(multiSelectComboBox) {
                  @Override
                  public Object preProcessValue(Object value) {
                      
                      System.out.println(".preProcessValue()" +value);
                    if (value == null) {
                      return value;
                    }
                    return combo.findModel(value.toString());
                  }
    
    
                  @Override
                  public Object postProcessValue(Object value) {
                      System.out.println(".postProcessValue() "+value);
                    if (value == null) {
                      return value;
                    }
                    return ((ModelData) value).get("value");
                  }
                };
    
    
            
            
            ColumnConfig typeColumn = new ColumnConfig();
            typeColumn.setId(UserResult.ACCOUNT_NAME);
            typeColumn.setHeader(Constants.VU_ACCOUNT_NAME);
            typeColumn.setWidth(150);
            typeColumn.setEditor(editor3);
    //        typeColumn.setRenderer(getAccountNameRenderer());
            typeColumn.setAlignment(HorizontalAlignment.LEFT);
            configs.add(typeColumn);
    
    
            ColumnConfig linksColumn = new ColumnConfig();
            linksColumn.setId(UserResult.USER_ID);
        //    linksColumn.setRenderer(getLinksRenderer());
            linksColumn.setWidth(80);
            linksColumn.setHeader(Constants.VU_ACTIONS);
            linksColumn.setAlignment(HorizontalAlignment.LEFT);
            configs.add(linksColumn);
    
    
        
    
    
            ColumnModel cm = new ColumnModel(configs);
            
            final EditorGrid<AccountResult> grid = new EditorGrid<AccountResult>(store, cm);
    //        grid = new Grid<UserResult>(store, cm);
            grid.setHeight(390);
            grid.setAutoWidth(true);
            grid.setTrackMouseOver(false);
            grid.setStripeRows(true);
            Registry.register(UserDetailsSummaryListUpdated.class.getName(), grid);
            this.add(grid);
    
    
    
    
    
    
    MultiSelectComboBox Class
    
    public class MultiSelectComboBox extends TriggerField {
    
    
        private Dialog checkBoxListHolder;
        private CheckBoxListView listView;
        private ListStore store;
    
    
        private String delimiter = ",";
        private boolean readOnly;
    
    
    
    
        public MultiSelectComboBox() {
            store = new ListStore();
            listView = new CheckBoxListView();
        }
    
    
    
    
    
    
    
    
        @Override
        protected void onTriggerClick(ComponentEvent ce) {
            super.onTriggerClick(ce);
            if(readOnly) {
                return;
            }
            System.out.println("Inside onTriggerClick");
            checkBoxListHolder.setSize(getWidth(), 200);
            listView.setWidth(getWidth());
            checkBoxListHolder.setPosition(getAbsoluteLeft(), 
                    getAbsoluteTop() + getHeight());
            if(checkBoxListHolder.isVisible()) {
                checkBoxListHolder.hide();
            }
            else {
                checkBoxListHolder.show();
            }
        }
    
    
    
    
    
    
    
    
        @Override
        protected void onRender(Element target, int index) {
            super.onRender(target, index);
    
    
            System.out.println("Inside onRender");
            checkBoxListHolder = new Dialog();
            checkBoxListHolder.setClosable(false);
            checkBoxListHolder.setHeaderVisible(false);
            checkBoxListHolder.setFooter(false);
            checkBoxListHolder.setFrame(false);
            checkBoxListHolder.setResizable(false);
            checkBoxListHolder.setAutoHide(false);
            checkBoxListHolder.getButtonBar().setVisible(false);
            checkBoxListHolder.setLayout(new FillLayout());
            checkBoxListHolder.add(listView);
            listView.setStore(store);
            setValue(parseCheckedValues(listView));
            
            checkBoxListHolder.addWindowListener(new WindowListener(){
    
    
                @Override
                public void windowHide(WindowEvent we) {
                    System.out.println("Inside windowHide");
                    setValue(parseCheckedValues(listView));
                }
    
    
            });
    
    
        }
    
    
    
    
        public void setChecked(List<AccountDTO> listCheckedAccountDTO){
            System.out.println("Inside setChecked");
            for (int i = 0; i < store.getCount(); i++) {
                            
                ModelData m =store.getAt(i);
                
                String label = m.get("label");
                
                if(listCheckedAccountDTO!=null){
                    
                    for (int j = 0; j < listCheckedAccountDTO.size(); j++) {
                        if(label.equals(listCheckedAccountDTO.get(j).getAccountName())){
                            listView.setChecked(m, true);
                        }
                    }
                }
            }    
        }
        
        private String parseCheckedValues(CheckBoxListView checkBoxView) {
            StringBuffer buf = new StringBuffer();
            if(checkBoxView != null) {
                System.out.println("Inside parseCheckedValues");
                
                List<BaseModel> selected = checkBoxView.getChecked();
                int index = 1, len = selected.size();
                for(BaseModel c : selected) {
                    buf.append(c.get(listView.getDisplayProperty()));
                    if(index < len) {
                        buf.append(delimiter);
                    }
                    index++;
                }
            }
            return buf.toString();
        }
    
    //Setter and getter
    
    }
    Last edited by dawesi; 5 Sep 2012 at 3:49 AM. Reason: put code in code tags

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi