4 Replies Latest reply on Jul 11, 2019 9:49 AM by Mätes

    IG Issue When Selecting "All Rows"

    Mätes

      Hi Experts,

       

      I'm using Apex 19.1 with ords 19.1 and Oracle RDBMS 12cR2. I've created a page that contains an IG that is being populated with > 1k number of rows. The issue here is that if I click on checkbox in header to select all rows only a few hundreds are marked:

       

      The pagination type is "Scroll", heading is set to "Fixed to Page" and Lazy Loading is set to "No".

       

      Any help is appreciated.

       

      Thanks,

       

      mätes.

       

      Update:

       

      For those who can/want help example: https://apex.oracle.com/pls/apex/f?p=73957

       

      User: Guest

      PW: mutti123

       

      Even in example app selecting all rows only affects 56 rows instead of all rows.

       

      Regards,

       

      mätes

        • 1. Re: IG Issue When Selecting "All Rows"
          John Snyders-Oracle

          Hi Mätes,

          This is the current expected behavior. The issue is that the database can hold a lot more information than the client can. 10 million is > 1K but that won't fit in the browser. So select all could mean select all rows that there are in the database (which cannot in all cases be represented on the client) or it could mean select all the rows that I can see on my screen right now or all the rows that are in my grid view right now. When combined with scroll paging this gets tricky because what you can see and what is in the grid view changes as you scroll.

           

          With no straight forward definition that works for large amounts of data what the grid does is select all the records that have been rendered into the DOM. I totally agree that this can cause confusion and not be what the user wants. Even if rows were selected as the user scrolled and new rows were rendered it would require the user to scroll to the bottom of the >1k records for the selection to be meaningful. The question is what do you intend to do with the selection?  For large numbers of records you are best off trying to do it on the server.

           

          Something complicated that you could try is: turn off select all using the declarative option in the row selector column (because you can't hook into that fake checkbox or the select all method). Then add your own select all button in the toolbar or elsewhere. This will use the model.fetchAll method to get all the data. Then loop over the data using forEach and call setSelectionState. Using advanced javascript init code set the grid option persistSelection. This is not something I have tried.

           

          Regards,

          -John

          • 2. Re: IG Issue When Selecting "All Rows"
            Mätes

            Hi John,

             

            Thanks a lot for explanation and suggestion, I'll try.

             

            Regards,

             

            mätes

            • 3. Re: IG Issue When Selecting "All Rows"
              Mätes

              Hi John,

               

              I've tried the following but it doesn't work either (action on a button in IG):

               

                      actions.add( {

                          name: "Select-All",

                          action: function(event, element) {

                              console.log("Selecting all rows...");

                              var view = apex.region("IG_DATABASES").widget().interactiveGrid("getCurrentView");

                              var model = view.model;

                              model.fetchAll( function( status ) {

                                 if ( status.done ) {

                                    model.forEach( function( record, index, id ) {

                                       model.setSelectionState(id, true);

                                    });

                                 }

                              });

                          }

                      });

               

              I think I have to change to page view and render only a view records so that "Select All" works or do you have an idea on how to implement?

               

              Regards,

               

              mätes

              • 4. Re: IG Issue When Selecting "All Rows"
                Mätes

                Hi John,

                 

                I've tried the following but it doesn't work either (action on a button in IG):

                 

                        actions.add( {

                            name: "Select-All",

                            action: function(event, element) {

                                console.log("Selecting all rows...");

                                var view = apex.region("IG_DATABASES").widget().interactiveGrid("getCurrentView");

                                var model = view.model;

                                model.fetchAll( function( status ) {

                                   if ( status.done ) {

                                      model.forEach( function( record, index, id ) {

                                         model.setSelectionState(id, true);

                                      });

                                   }

                                });

                            }

                        });

                 

                I think I have to change to page view and render only a view records so that "Select All" works or do you have an idea on how to implement?

                 

                Regards,

                 

                mätes