Announcement

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

    Unwanted regrouping when changing grouped values

    Hi,
    I am working on project with SmartGWT on client side (6.0p version). There is a problem with saving data when records are grouped. Let's say records are grouped by COL1 column, and we want to change value of that column. The record which is changed goes to another group is marked as changed, but without specified field. I am not using autosaving, so when I try to invoke save operation, saving freezes.
    After short analysis of your code, problem lays on that line (ListGrid.js):

    Code:
    if (this.isGrouped && (!saving || !this.shouldSaveLocally())) {
      this._updateGroupForEditValueChange(rowNum);
    }
    All I need is to disable auto regrouping records after changing values. Is there any possibility to avoid regrouping?
    I Java code:

    Code:
    final int[] allEditRows = grid.getAllEditRows(); //returns edited records
    grid.saveAllEdits(new Function() {
       @Override
       public void execute() {
          [...] //execute is not invoked
       }
    });

    #2
    We have not provided a way to avoid regrouping in this situation, as that would leave the display invalid. However, this regroup should interfere with saving and does not in a brief test, so if you are seeing that effect, we need a way to reproduce the problem.

    You should also at least use the latest patched version (you didn't specify your version - this is always required) and consider an update to 6.1 as well.

    Comment


      #3
      I updated version to 6.1p (build 2018-03-21), but nothing changed in this case.
      Do you have Plunker environment or something similar to reproduce the problem?
      Disabling regrouping in edit mode (state before save) is important client requirement, so I need to handle it anyway.

      Comment


        #4
        See the Debugging topic for advice in creating test cases if you think this might be a framework bug.

        If you want to avoid regrouping - so show edited records in the wrong groups - you will need to do something such as reject the user's changes but hold onto the value they entered as another attribute on the Record, and use a CellFormatter to cause it to be shown.

        Comment


          #5
          Hi Isomorphic,
          I created demo based on your samples, added as attachment (grouping demo and datasource demo merged).
          Scenario #1:
          1. Choose any existing row, edit Government cell.
          2. New value has blue color - OK.
          3. Save data - from logger: - OK
            • ROWS TO SAVE: 1
            • --DATA SAVED

          Scenario #2:
          1. Choose any existing row, edit Continent cell, e.g. Asia -> Europe.
          2. New value hasn't blue color - BUG.
          3. Record changed position - We're trying to avoid this situation.
          4. Save data - from logger: - BUG, data are not saved
            • ROWS TO SAVE: 1

          As you see, there is a bug while saving data - callback method are not invoked. My saving method rely on those callback, so saving freezes. As I mentioned before, this can be simple omitted by turning off _updateGroupForEditValueChange(rowNum) method.
          Attached Files
          Last edited by dockitu; 28 Mar 2018, 23:44.

          Comment


            #6
            Hi Isomorphic,
            is that demo satisfies you? I can send you more evidences about that case.

            Comment


              #7
              We tried with the exact version you mentioned, SGWT LGPL 6.1p dated 2018-03-21, and we don't see any problem. As mentioned, immediately regrouping is expected behavior and not considered a bug. Specifically, we see;

              Scenario #2:
              1. Choose any existing row, edit Continent cell, e.g. Asia -> Europe.
              2. New value has blue color - OK
              3. Record changed position - this is expected behavior as mentioned
              4. Save data - from logger - OK
                • ROWS TO SAVE: 1
                • --DATA SAVED

              We're not sure why you're seeing an issue - perhaps your update wasn't done correctly? Make sure you clear your browser's cache and verify the version string displayed in the showcase or isc.version in the console.

              Comment


                #8
                Hi Isomorphic,
                it looks like clearing everything (cache, IDE, maven) helped. Now it's working correctly, 6.1p version fixed issue. Thanks for help!

                Comment

                Working...
                X