Announcement

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

    Upgrade 6.0p 05-28 to 08-04 breaks behavior of validator on ListGridField

    Hi,

    we have upgraded from 6.0p-2016-05-28 to 6.0p-2016-08-04 and hit regression issue in our ListGrids. We have a ListGrid with couple of ListGridFields, e.g. fieldA, fieldB etc.
    There are no dependencies between fields.

    Behavior I see:

    OLDER VERSION (6.0p-2016-05-28)

    In older version validator is only triggered when user is editing field A. Nothing happens when user edits (inline-editor) field B.

    CURRENT VERSION (6.0p-2016-08-04)

    In the current version, validator is triggered all the time - when user edits (inline editing) field A, but also when he edits field B.
    And this is breaking our application.

    Was there any change? Is this a regression bug?


    Code:
    On field fieldA we have a custom validator added with this piece of code (see below) and validator is defined as next (bottom).
    
    ListGridField elementName = [B]new [/B]ListGridField(...); elementName.setType(ListGridFieldType.[B][I]TEXT[/I][/B]);
    elementName.setValidators([B]new [/B]ElementNameValidator());
    elementName.setEscapeHTML([B]true[/B]);
    
    ListGridField elementLabel = [B]new [/B]ListGridField(...);
    elementLabel.setType(ListGridFieldType.[B][I]TEXT[/I][/B]);
    elementLabel.setEscapeHTML([B]true[/B]); ...
    
    [B]class [/B]ElementNameValidator [B]extends [/B]CustomValidator {
    @Override [B]protected boolean [/B]condition(Object value) { ... }
    }

    #2
    There was a bugfix to cause validator.dependentFields to be correctly honored with inline editing in grids. If you are not using validator.dependentFields, there should be no change in behavior, and none of our automated tests show regressions. If you think you're seeing a regression, we'll need a way to reproduce the problem, ideally, a ready-to-run, minimal test case that we can try out to see the problem.

    Comment


      #3
      Hello,

      I would like to report that it is a regression.

      I was looking to sources you provide and I have found a spot where it is probably broken.


      Listgrid.js
      37716: validateRowValues : function (newValues, oldValues, curValues, rowNum, fields) {
      .....


      37768: newValue = isc.Canvas._getFieldValue(dataPath, field, curValues,
      37769: this, true, "validate");
      37770: oldValue = isc.Canvas._getFieldValue(dataPath, field, oldValues,
      37771: this, true, "validate");
      37772:
      37773: if (!shouldValidateCell) {
      37774: shouldValidateCell = (newValue !== undef || oldValue === undef || oldValue == null);
      37775: }
      37776: if (!shouldValidateCell) continue;
      .....
      }


      Problematic code is on line 37768. You have changed newValues to curValues, that always contains whole row (according to documentation: Field-value mapping showing the current values for each field, meaning the edited values combined with and overriding the values for each field before editing) and not only new values. Therefore newValue has always value even when it was not changed and validator is fired eventhough nothing changed.


      Hopefully this helps.

      Comment


        #4
        Thanks for pointing this out. This should be fixed in SGWT 6.0p/SC 11.0p and newer in the nightly builds dated 2016-08-10 and beyond.

        Comment

        Working...
        X