Announcement

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

    addDataArrivedHandler does not select Record

    Hi,

    I am trying to preselect some records, when the grid is rendering. I am using a Paged List Grid bound to a SQL datasource. I have rewritten preselection logic in the addDataArrivedHandler. But it never works. Neither on first time load nor or user scroll. But if i filter data it works.

    Below is the code snippet:

    listGrid.addDataArrivedHandler(handler -> {
    if (null != alreadySelectedValues && !alreadySelectedValues.isEmpty()) {
    final List<ListGridRecord> matchedRecords = Arrays.stream(listGrid.getRecords())
    .filter(rec -> alreadySelectedValues.contains(rec.getAttribute("name"))).map(ListGridRecord::new).collect(Collectors.toList());
    listGrid.selectRecords(matchedRecords.toArray(new ListGridRecord[0]));
    }
    });

    Smart GWT version: 12.1-p20200709

    #2
    I tried printing the length of the listGrid.getRecords(). Turns out its always zero in this case.

    Comment


      #3
      Is the ListGrid grouped? If yes, you might need a different API.

      Comment


        #4
        getRecords() called from DataArrived is working as expected and returns a correct length. Let us know if there is some way to reproduce the claimed problem.

        Comment

        Working...
        X