example code anomalies

Posted by GregHiggins on 19-Mar-2018 01:33

So this is from Chapter 2: Kendo UI Designer Overview, Table 4: controller.public.js file for customer_view

// Fired when view content is loaded
onShow($scope) {
  var that = this;

  this.customerModel = $scope.vm.$viewModels.CustomerDSModel;

  ....

}

onSaveClick(e){
  var dataItem = this.customerDS.get(this.customerModel.id);
  var that = this;
  dataItem.set( "SalesRep", this.customerModel.SalesRep );

...

}

Maybe I'm missing some crucial setup set, but I can't get this to work in my scenario. It looks to me as if a data record is defined in the onInit function and a data field in the record is accessed in the onSaveClick event.

What I'm trying to do is set up the data record in onInit and access the field in a Select event. The field always returns "".

 How does the model get updated? If the datasource is associated with the component and so is the model, why would the model not be updated? 

All Replies

This thread is closed