Announcement

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

    listgrid records disappear after an update

    Context:
    In our application we use fetch criteria that contain fields that are not in the datasource. (these criteria are processed using custom fetches and dmi).
    The fetched client side records don’t match all these criteria, since they don’t contain values for some of these criterions).

    Problem:
    This causes the records to disappear on update (which we don’t want).

    Semi workaround:
    We’re aware that neverDropRowsOnUpdate exists and works, but that’s a bit too strict: users can also filter on actual datasource fields and then we do want the records to drop after an update if they no longer satisfy the user filter).
    We also saw that neverDropRowsOnUpdate does not work for a TreeGrid
    (since setDataProperties needs a Tree and there is no such method there)

    Question:
    Is there a possibility to add an attribute like doNotTakeIntoAccountNonDataSourceCriteriaToMatchRecordsClientSide, or does such a thing exist already?

    Environment:
    Using SC_SNAPSHOT-2011-08-02/PowerEdition Deployment 2011-08-02

    #2
    There isn't a setting for this, but there are SmartClient-level documented override points that would allow you to implement this: ResultSet.applyFilter. You could either just create a one-off for yourself via JSNI, or make it an SGWT override point (see pattern used elsewhere, such as ListGrid.getCellCSSText) and submit it as a patch.

    Comment


      #3
      ResultSet.applyFilter was not called after an update, but DataSource.recordMatchesFilter was. It seems like you already had an undocument SmartClient property that did what I wanted: dropUnknownCriteria. This was taken into account correctly for normal criteria, but not for advancedcriteria, I think.

      Please find below the changes I made.

      Any chance you could include this in your new nightlies, so we don't miss other changes?

      Code:
      $wnd.isc.DataSource.addProperties({
                      dropUnknownCriteria: true,
                      evaluateCriterion: function(_1,_2){
                                     if(_2.requiresServer==true)
                                                     return true;
                                     var _3=this.getSearchOperator(_2.operator);
                                     if(_3==null) {
                                                     isc.logWarn("Attempted to use unknown operator "+_2.operator);
                                                     return false;
                                     }
                                     if(this.$80m) {
                                                     if(_2.fieldName) {
                                                                     var _4=this.getField(_2.fieldName);
                                                                     if (_4==null) {
                                                                                    if (this.dropUnknownCriteria) {
                                                                                                    this.logInfo("evaluateCriterion passed criterion for field not explicitly "+"listed in this dataSource:"+_2.fieldName+" - dropping this filter","AdvancedCriteria")
                                                                                                    return true;
                                                                                    } else {
                                                                                                    this.logInfo("evaluateCriterion passed criterion for field not explicitly "+"listed in this dataSource:"+_2.fieldName+" - continuing with filter","AdvancedCriteria")
                                                                                    }
                                                                     } else{
                                                                                    var _5=this.getFieldOperators(_2.fieldName);
                                                                                    if(!_5.contains(_3.ID)) {
                                                                                                    this.logWarn("Operator "+_3.ID+" is not valid for field "+_2.fieldName+". Continuing anyway.")
                                                                                    }
                                                                     }
                                                     }
                                     }
                                     return _3.condition(_2.value,_1,_2.fieldName,_2,_3,this)
                      }
      });

      Comment


        #4
        Thanks for the contribution - yes we can add this, however, it might take a week or two. We'll post here when it's in.

        Comment


          #5
          Ok this has been rolled into the framework. Should be present in the next 3.0 nightly build (dated Oct 21 or greater).
          If you don't see it or its not working as expected, let us know.

          Thanks
          Isomorphic Software

          Comment

          Working...
          X