Announcement

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

    When filter applied to ListGrid, selectAllRecords() method can not select all records successfully.

    Hello Isomorphic,

    I am working on a project and I use ListGrid. I want to have a UI button that selects all grid lines of ListGrid. For this, I created a new window and I added a Button (com.smartgwt.client.widgets.toolbar.ToolStripButton.ToolStripButton()). I overrided onClick() method like this :

    Code:
     // select All button
            ToolStripButton selectButton = new ToolStripButton();
            selectButton.setTooltip("Select All");
            selectButton.setIcon(IconConstants.SELECT_ALL);
            selectButton.addClickHandler(new ClickHandler() {
    
                @Override
                public void onClick(ClickEvent event) {
    
                    table.selectAllRecords();
                }
    
            });
    Code works when filters are not applied. When I apply a filter and some list records are filtered, then only a subset of the remaining records are selected.

    I would really appreciate it if someone could help!

    Best Regards,

    Leo

    P.S : I use gwt 2.8.2

    #2
    That’s intended and the correct design. If the user is looking at a set of records and presses Select All, they are expecting to select all the records they can see, and not to select some other set of records that you have cached and that they do not know you have cached.

    If you want to safely provide a select all operation that operates on all records, you should be showing a list of all records to the user at that moment.

    Comment


      #3
      Hello Isomorphic,

      Thank you for your instant reply.
      In my case, I have a ListGrid with multiple records, and somethimes these records could be >400. There is a use case when user needs to select all these 400 records and perform a GUI action by right clicking on the selected records. Is it possible to implement selectAll feature to select also the rest records that are not visible without scrolling?

      Thanks in Advance,

      Leo.

      Comment


        #4
        As we covered, a filtered grid must not allow selection of records eliminated by criteria.

        Now it sounds as if you are talking about records that are not yet loaded due to data paging. If data volume is guaranteed to remain relatively small, you can just turn off data paging via dataFetchMode:"basic", and then selection of the full dataset is allowed.

        If data volume might be very large, then the correct way to perform an operation on all records is to do it via criteria, so the full set of records is never loaded. If you are trying to update all the records with the same set of values, you could do this via operationBinding.allowMultiUpdate.

        As far as the UI for this, you would have your own, separate, select all checkbox, and you would turn off normal selection while your select all checkbox is checked (setSelectionType("none")). You could style all the records as though they were selected (via getBaseStyle()) if you want, or just show some other indication.

        Comment


          #5
          Yes, sorry for not beeing clear. I was talking about records that are not yet loaded duo to pagination, and need scrolling to be loaded. Data volume is guaranteed to remain under 100.000 records. I gave a try using dataFetchMode:"basic" and it worked for ~~400 records. Do you suggest to go for the operationBinding.allowMultiUpdate or 100.000 is considered to be relatively small?

          Comment


            #6
            While modern browsers on modern hardware can handle loading 100,000 records, you would be creating a huge amount of database load and network load for no real reason, so we would recommend the second approach we explained.

            Comment


              #7
              Hi sonan4,

              I myself wouldn't consider 100.000 small. Just see the response size in your F12 browser tools network tab.
              "Small" ends for me at 1.000, perhaps 5.000 records, depending on client browser, hardware, and network.

              See here and add , dataFetchMode: "basic"
              For 3959 "narrow" rows with just 8 fields you get a result of 705kb (159kb compressed).

              Best regards
              Blama

              Comment

              Working...
              X