Announcement

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

    Selection update issue when the row is removed

    1. I add the selection update handler to the listgrid:

    addSelectionUpdatedHandler(new SelectionUpdatedHandler() {
    @Override
    public void onSelectionUpdated(SelectionUpdatedEvent event) {
    setSelectedRecords(getSelectedRecords());
    }
    });

    2. When the only selected row is removed from the data source, the list grid is updated with no selection. However, the event is not triggered. The UI is not fully updated.

    What can I do?

    #2
    Same issue with filter

    Same issue with filter. When this only select row is filtered out, there is no selection update event.

    Comment


      #3
      If you want to take action in these circumstances, you can add a DataChanged handler and see if the selected record is still in the dataset using ResultSet.find().

      Comment


        #4
        It works for remove case.

        For the filter out case, getSelectedRecords() still returns the filtered out selection.

        Clear filter will bring the selection back, sometimes.

        Comment


          #5
          Again, same solution - ResultSet.find().

          Comment


            #6
            ResultSet.find() has performance issue with large data set.

            I'd like to ask a different question. When a row is filtered out, can the selection be cleared?

            Comment


              #7
              No, most code that might update other components does not want to clear the related components just because the selected record is not currently visible in the filter. This behavior will not be changed. Use ResultSet.find() to see if the record is still in the cache if you need to catch this case.

              Comment


                #8
                Why in the world would removing the selected record (by calling removeSelectedRecords()) not cause a SelectionUpdatedEvent to occur?? That seems to make no sense and causes us to have to add code places that don't make sense to.

                Comment


                  #9
                  ?

                  Reread post 7, it explains that the most commonly desired behavior is what the framework is doing.

                  You may have a less common case. Less common cases generally require a little more code.

                  Comment


                    #10
                    Originally posted by Isomorphic View Post
                    ?

                    Reread post 7, it explains that the most commonly desired behavior is what the framework is doing.

                    You may have a less common case. Less common cases generally require a little more code.
                    Post 7 talks about filtering not record removal (deletion). The event firing has nothing to do with clearing forms and what not, that is an implementation detail. The simple fact is that the current selection is changed, because the record is no longer available, and the selection handler is not notified. That is a bug.

                    Comment

                    Working...
                    X