Method is not called when subscribing to a field change in attributes

Problem

There is a field:

{
   "operation": "insert",
   "name": "UsrJob",
   "values": {
      "layout": {"column": 0, "row": 0, "colSpan": 12},
      "bindTo": "UsrJob"
   },
   "parentName": "Header",
   "propertyName": "items"
}

The attribute property contains subscription to the event

"Job": {
   dependencies: [{ 
      columns: ["UsrJob"],
      methodName: "jobChanged"
   }]
}

The jobChanged() method does not receive UsrJob value when the field is changed. The page schema is inherited from BasePageV2.

Cause

The user overrode the method of the onEntityInitialized() parent schema in the created schema as follows:

onEntityInitialized: function() {
   this.set("IsChanged", true);
   if (this.isAddMode()) {
      this.hideBodyMask();
      return;
   }
   var forecastId = (this.isCopyMode())
   ? this.get("SourceEntityPrimaryColumnValue")
   : this.get("Id");
   if (!Ext.isEmpty(forecastId)) {
      var esq = Ext.create("Terrasoft.EntitySchemaQuery", {
      rootSchemaName: "UsrForecastDimension",
      rowCount: 1
   });
   esq.addColumn("Id");
   esq.addColumn("UsrDimension");
   esq.filters.add("ForecastFilter", Terrasoft.createColumnFilterWithParameter(
      Terrasoft.ComparisonType.EQUAL, "UsrForecast", forecastId));
   esq.getEntityCollection(function(response) {
      if (response && response.success) {
         var collection = response.collection;
         if (collection.getCount() > 0) {
            var collectionItems = collection.getItems();
            var dimensionItem = collectionItems[0];
            var dimension = dimensionItem.get("UsrDimension");
            this.set("UsrDimension", dimension);
         }
      }
      this.hideBodyMask();
      }, this);
   }
},

The onEntityInitialized() method of the base schema was not called.

Solution

In the replacing method, add the following string:

this.callParent(arguments);

 

Like 0

Like

Share

0 comments
Show all comments