Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    DynamicForm setEditorType

    I have a dynamic Form which has static text Items and a edit button. On click of the button, The textItems should change to selectItems. Can we do this using GWT? If yes, can you please let me know of any example?

    Thankyou.

    #2
    I tried the following

    Code:
    private DynamicForm getDetails(final ListGridRecord record) {
            
          DynamicForm form = new DynamicForm();        
          StaticTextItem sec = new StaticTextItem("sec","secs");
            sec.setValue(record.getAttribute("sec"));
    
          ButtonItem button = new ButtonItem("edit","edit");
          button.addClickHandler(new addClickHandler(new ClickHandler() {
                    @Override
                    public void onClick(ClickEvent event) 
                      setUpHandler(form);
          }
       });
     
       form.setFields(sec,button);
    }
    
    private void setUpHandler(DynamicForm form) {
            
           String[] anArray; 
            anArray = new String[100];      
            for(int i = 0;i< 60; i++){
                anArray[i] = Integer.toString(i);
            }
           
            SelectItem secSelect = new SelectItem("secSelect");
            secSelect.setMultiple(true);
            secSelect.setValueMap(anArray);
           
           form.getField("sec").setEditorType(secSelect);      
    }
    I am new to GWT and is there something i am missing, as i am getting the error
    editContext.data' is null or not an object'

    Thankyou

    Comment


      #3
      any ideas?

      Comment


        #4
        setEditorType() is not what you're looking for. You can't change FormItems on the fly like that, you could create a form with all the items needed, hide the selectitems, then show them on the button click and hide the textitems. But it sounds more like either having a more modular form, seperate forms, or using combobox is a far better approach in your situation.

        Comment

        Working...
        X