Announcement

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

  • SmartClient 6.0 - Unnecessary fetch after removing data

    In SmartClient 6.0, an issue exists whereby if a record is removed from a databound component (and therefore removed on the server) in some cases the component will issue an unnecessary fetch request after the removal completes.
    This issue will typically not have any user-noticeable effect on the application, but does cause an extra server turnaround which is not required.

    The patch below will resolve this issue for the 6.0 release.

    Code:
    //----------------------------------------------------------------------------
    // Isomorphic SmartClient 6.0 patch
    // Purpose: Resolve an issue whereby unnecessary fetches could sometimes occur after removing
    // a record from a dataSource.
    // 
    // Applies to SmartClient 6.0 builds only
    //----------------------------------------------------------------------------
    if (window.isc && isc.version.startsWith("6.0/")){ 
    
    if (isc.ResultSet != null) {
    isc.ResultSet.addMethods({
    removeCacheData : function (_1) {
    if (!isc.isAn.Array(_1)) _1 = [_1];
    var _2 = this.allRows != null && this.useClientFiltering;
    var _3 = _2 ? this.allRows : this.localData;
    for (var i = 0; i < _1.length; i++) {
    var _5 = this.getDataSource().findByKeys(_1[i], _3);
    if (_5 == -1) {
    this.logInfo("ignoring 'remove' operation, deleted row not part of this ResultSet: " + this.echo(_1[i]));
    } else {
    _3.removeAt(_5);
    this.cachedRows -= 1;
    }
    }
    if (!_2 && this.isPaged()) {
    this.setFullLength(this.totalRows - _1.length);
    }
    }
    
    })
    }
    } else if (window.isc) {
      isc.Log.logWarn("Patch for SmartClient 6.0 builds included in this application. " +
                "You are currently running SmartClient verion '"+ isc.version + 
                "'. This patch is not compatible with this build and will have no effect. " +
                "It should be removed from your application source.");
    
    }
Working...
X