Announcement

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

    ListGrid Warning message :"Can't select many records at once

    If i select all records in the ListGrid,it will show warn Message.
    so how to rectiy this issue.

    if it is 2000 records it shows problem.


    Message: Can't select many records at once.please try work with smaller
    batches.

    Please find the attached screen shot in below.

    I am waiting for u r reply.
    Attached Files

    #2
    This message appears when trying to select records that are not yet loaded. If the grid is load-on-demand, you will need to fetch the entire set before all records can be selected.

    Comment


      #3
      Thanks david.

      Can you send me the code please how to select all records from the grid.

      I am trying to do this issue,but i am not solving the issue.

      Thanks
      Praveen

      Comment


        #4
        If you have a limited number of records you can tell the grid to load them all instead of paging: setFetchMode(BASIC).

        Comment


          #5
          Are you a developer with SmartGWT/SmartClient?

          If so... let me say that the Live grid implementation is spectacular.... but...

          (there is always a "but")....

          You can very very close to a complete solution. But the restriction that you have to load all the rows you're about to select before you select them...this is a BIG BIG limitation.

          The "selection" should be maintained as meta data and then depending on what data gets loaded into the live grid... the selection state is applied programmatically.

          Then you have a facility which can truly handle thousands of records.

          In my vision... a select all just adds one bit of information to the grid selection="all" ...then when the grid is loaded somewhere in the middle, it would show everything as selected.

          If the user then deselected rows 1000-1010 the selection would be:

          selection="ALL,-(1000-1010)"

          if he then reselected rows 1005 and 1008 the selection would be:

          selection="ALL,-(1000-1010),+1005, +1008"

          granted, it would be more complicated because of sorting but I'm keeping it simple to communicate the principle.

          - Bob

          Comment


            #6
            Your proposal doesn't work - still leads to unbounded data being maintained in order to maintain gappy selections (imagine select first half of dataset, then sort).

            What does work and is already there is the grid.selectionProperty which allows you to maintain a server-side selection and convey it incrementally to the client.

            Comment


              #7
              I've built it already.

              I maintain the selection as meta-data - essentially an ArrayList of SelectAction objects.

              A SelectAction is one of the following:
              1. SelectAll
              2. SingleSelect
              3. RangeSelect
              4. IncludeSelect
              5. ExcludeSelect

              With this, you can derive the selection status of any row in the grid without actually loading that row.

              I also store the sort column and sort order at the time of each SelectAction so that I can do the derivedSelection at any point into the future....when the user scrolls around, the correct selection state of each row is maintained....even across sorts.

              There is no "unbounded data" since there is no "select list"...just the meta data used to derive whether or not any particular row is "selected".

              The serverSide approach would be similar...each time the user creates a SelectAction...that info is communicated to the server so that when new dataSource records are served up, they can have the selectionProperty "isSelected" set properly so that it appears selected on the client.

              The problem with the serverSide approach is that you need the cooperation of the server (not always the possible) and it involves a roundtrip to the server just to manage the selection meta data each time the user clicks.

              Comment


                #8
                Again, this won't work without server support because of the use case of selecting half the dataset and sorting such that indices are scrambled. This case requires you to maintain a potentially unbounded list of unique ids client-side, or have server-side support for mapping between pre- and post-sorted indices, or similar.

                It's a perfectly reasonable solution if you do not need to support sorting.

                Comment


                  #9
                  Hi,

                  We also encountered the problem/error message "Can't select many records at once. Please try work with smaller batches." and therefore read through this email a few times. However, we are unsure how to follow Isormorphic's suggestions.

                  We read through the documentation for "getSelectionProperty", but we did not find it sufficiently helpful. We therfore tried a trial-and-error approach as follows:

                  1) We set the setSelectionProperty to "isSelected", as follows:

                  lgSelectFilesFromTree.setSelectionProperty("isSelected");

                  and then tried to set the "isSelected" attribute for a bunch (eg 1000) listgrid records. (We even tried to call the save operation). The code snippet is below:

                  for (int i=0; i < 1000; i++ ) {
                  ListGridRecord lg = lgSelectFilesFromTree.getRecord(i);
                  lg.setAttribute("isSelected", true);
                  Boolean didSave = lgSelectFilesFromTree.saveAllEdits();
                  System.out.println("DidSave is " + didSave);
                  }

                  but the above only select a few of the 1000 records and marked them as selected; moreover, it did not seem to do any server-side save and it was slow to process. Finally, it did not return any errors, even though it did NOT update 1000 records.

                  2) We also tried a series of other "tricks", such as:

                  int[] testInt = new int[1000];
                  for (int i=0; i < 1000; i++ ) {
                  testInt[i]=i+1;
                  }
                  lgSelectFilesFromTree.selectRecords(testInt);

                  We were hoping that it would set all 1000 records; but, it did not. It only selected a few (eg first 75 or so). Moreover, it did not return with any error to indicate that the remaining 900+ records had not been selected.

                  So, could there be a bit more elaboration on how, in SmartGWT, one is supposed to both use the "paging" feature of listgrids yet still select all the records? (And, is there a reason this is not implemented by default in the paged listgrids?)

                  FYI: As an aside, in our use-case-scenario, we need to allow the user to select "all 1000+ rows" (which correspond to the 1000+ client fileds that we're storing) and then based on the selection, we intend to "add" the 1000+ selected rows to another table to mark these as "selected files" for the user.

                  FYI #2: An another aside, if we turned off paging (e.g., lgSelectFilesFromTree.setDataFetchMode(FetchMode.BASIC)), then not only was the loading of the listgrid a bit slower (as expected), but the selecting of all records took quite a bit of time according to one of the developers/test-users (e.g, > 4 seconds). (It also did not display any "hourglass" icon, though really, the problem is that it wansn't "instantaneous" to begin with.)

                  Any thoughts are appreciated.

                  Further operational details are below:

                  ========
                  OS: Windows XP Pro
                  IDE: MyEclipse 9.0 with Google Plugin for Eclipse (2.3.1)
                  SmartGWT EE 2.4
                  Browwer: Mozilla Firefox 4.0.1
                  GWT SDK: 2.2
                  Sun JDK 1.6.0_13

                  Comment

                  Working...
                  X