Announcement

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

    ListGridField setHidden issue

    Good day , currently I am having an issue regarding the list grid field set hidden issue. As default, the list grid field is shown and there is a checkbox that will enable the set hidden function. When I click the checkbox, the list grid field will be hidden but when I unclick the checkbox again, the list grid field won't show again. The sample code below describe the issue that I am having.



    public class home implements EntryPoint {

    private ListGrid grid;
    private ListGridField name;
    private ListGridField discipline;

    public home() {

    }

    @Override
    public void onModuleLoad() {

    VLayout lay = new VLayout();
    lay.setWidth100();

    DynamicForm form = new DynamicForm();

    CheckboxItem check = new CheckboxItem("check","Check");
    check.setShowTitle(false);
    check.addChangedHandler(new ChangedHandler(){

    @Override
    public void onChanged(ChangedEvent event) {
    // TODO Auto-generated method stub
    if(event.getValue().equals(true)){
    setHideGridField();

    } else {
    setShowGridField();
    }

    }

    });

    form.setFields(check);

    grid = new ListGrid();
    grid.setWidth100();

    name = new ListGridField("name","Name");
    discipline = new ListGridField("disc", "Discipline");

    grid.setFields(name, discipline);

    lay.addMembers(form, grid);
    lay.setBorder("1px solid black");
    lay.draw();

    }

    public void setHideGridField(){
    GWT.log("setGridHidden");
    discipline.setHidden(true);
    grid.setFields(name, discipline);

    }

    public void setShowGridField(){
    GWT.log("setShowGrid");
    discipline.setHidden(false);
    grid.setFields(name, discipline);
    }

    }


    Please update me regarding this issue that I am facing now. Thank you



    #2
    See docs: do not use APIs on ListGridField after they have been provided to setFields(). Use listGrid.showField() / hideField() instead.

    Comment


      #3
      It work perfectly.
      Thank you.

      Comment

      Working...
      X