Announcement

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

    Grouping related bug

    Hi Isomorphic,

    I unfortunately found a grouping related bug, which can be easily reproduced within your Showcase.

    Please go to the http://www.smartclient.com/#fetchOperationFS, replace the "fetch.js" tab with the content I send you in the attachment, click "Try it" and finally click on the "CLICK TO REPRODUCE THE BUG" button.

    Thank you very much in advance for fixing it.

    Best Regards

    Dusan Kaloc
    Attached Files

    #2
    Thanks for the report. Technically, the grid shouldn't end up wedged in this case, but this is a weird and inefficient way to structure your code which will result in duplicate fetches. You can solve the problem by calling fetchData(), waiting for data to arrive, then grouping.

    Comment


      #3
      Hi,

      thank you for taking care of it.

      As for the code, by no means was it meant as a sample production code. Please believe us, we do not write such a code in our app :-). I coded it up solely for you to reproduce the bug as easily as possible.

      The real case behind it is:

      1) We enable our users to save ListGrid prefs in our database.
      2) Such prefs may contain the grouping state.
      3) Now, please suppose a user has 500 records result set, which is grouped by a field.
      4) The user saves such preferences.
      5) As the times goes the result set grows, eventually past the "groupByMaxRecords" limit.
      6) After some time the user asks for the grid/result set again. Say it now has 5000+ rows. The prefs are automatically applied, but it is no more grouped, because of the limit.
      7) All is fine until the user filters the grid via the filter editor so that the filtered result set is less than the groupByMaxRecords limit.
      8) Now the user gets the exception.

      Technically, we think you forgot to clear all the grouping-related flags after calling clearGroupBy() in regroup(). Namely _isGrouped is not cleared, because it only gets deleted when the _setMarkForRegroup is called with the calledFromRegroup flag equal to true. But obviously it is never called, because you return from the regroup sooner.

      So for the meantime we at least came up with this workaround. Of course we are not 100% sure if it is correct, but seems to work with no harmful side effects:
      Code:
      var clearGroupByProto = isc.ListGrid.createRaw().clearGroupBy;
      isc.ListGrid.addMethods({
        clearGroupBy : function() {
          // $141w === minified and obfuscated _isGrouped
          this._isGrouped = this.$141w = undefined;
          clearGroupByProto.apply(this, arguments);
        }
      });
      Thank you again

      Dusan Kaloc

      Comment


        #4
        Thanks for pointing this out - tonight's builds should contain a fix for this issue. You didn't state what release you're using. Due to differences in older code streams, we'll only be porting the fix for this back to SC 9.0p/SGWT 4.0p.
        Last edited by Isomorphic; 8 Dec 2014, 18:38.

        Comment


          #5
          Hello,

          thank you very much for the fix.

          As for the versions, fixing it back to SC 9.0p is absolutely fine for us, because we either use v9.1p_2014-07-24 or the most up-to-date 10.0p.

          Thanks again and best regards

          Dusan Kaloc

          Comment

          Working...
          X