Announcement

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

    ListGrid.getField return null for an hidden field after the list was hidden

    After the list was hidden, getField return a valid reference for a shown field, but return null for an hidden one. After the list is shown again, getField start returning a valid reference again. The behaviour should be the same for hidden and shown field

    ListGrid list = new ListGrid();

    ListGridField f1 = new ListGridField("a");
    f1.setHidden(true);

    ListGridField f2 = new ListGridField("b");
    list.setFields(f1, f2);

    if (list.getField("b") == null) {
    System.out.println("Before hide: Field b is null");
    }

    if (list.getField("a") == null) {
    System.out.println("Before hide: Field a is null");
    }

    list.show();
    list.hide();

    if (list.getField("b") == null) {
    System.out.println("After hide: Field b is null");
    }

    if (list.getField("a") == null) {
    System.out.println("After hide: Field a is null");
    }

    list.show();

    if (list.getField("a") == null) {
    System.out.println("After show: Field a is null");
    }

    #2
    See docs - this behavior is documented and expected. The "fields" array contains just the visible fields.

    Comment


      #3
      My test case show that the "fields" array contains just the visible fields when the list is HIDDEN, because when the list is visible, The "fields" array contains ALL the fields even the hidden one.

      Hidden list = only visible field
      Displayed list = all the field, even the hidden one.

      According to me, if this is by design then the design is wrong.

      Comment


        #4
        The first show() causes drawing to occur, so that's the effect you're seeing, and it's again expected.

        Comment

        Working...
        X