i would like to access the messages of Response which is send by server whether it may be a failure or success message.
The above code works properly both in add and update.
How to handle the response?... My response object looks like {Success: true, Message: 'Record successfully updated...' }
Note: I m able to access the response using jquery ajax but i want to access only when datasource sync
Thanks in advance,
Ramesh
//===================================================== DATA SOURCES ==============================================================|
var projectDS = new kendo.data.DataSource({
transport: {
create: {
url: '/api/HomeApi/Add',
type: 'POST',
contentType: 'application/json;charset=utf-8'
},
read: {
url: '/api/HomeApi/Get?projectId=' + $('#UrlProjectId').val(),
dataType: 'json'
},
update: {
url: '/api/HomeApi/Update',
type: 'PUT',
contentType: 'application/json;charset=utf-8',
success: function (response) { // this part also not works...
alert(response.IsSuccess);
}
},
parameterMap: function (options, operation) {
if (operation !== 'read') {
return JSON.stringify(options);
}
return options;
}
},
schema: {
model: {
id: 'Id',
fields: {
Id: { type: 'number', editable: false },
Title: { type: 'string', },
Description: { type: 'string' },
StartDate: { type: 'date' },
EstimatedEndDate: { type: 'date' }
}
}
},
change: function () {
projectFormVM.set('currentRecord', this.view()[0]);
},
success: function (e) { // how to get this function works
alert(e);
}
});
//===================================================== VIEW MODELS ===============================================================|
// Add & Update Project View Model
var projectFormVM = kendo.observable({
currentRecord: null,
projectDataSource: projectDS,
projectListUrl: '/Home/Projects',
hasUpdate: (($('#UrlProjectId').val() != '') ? true : false),
onStartDateChange: function () {
var thisStartDate = this.get('currentRecord').StartDate;
if (thisStartDate) {
$('#EstimatedEndDate').data('kendoDatePicker').min(thisStartDate);
}
},
onEndDateChange: function () {
var thisEndDate = this.get('currentRecord').EstimatedEndDate;
if (thisEndDate) {
$('#StartDate').data('kendoDatePicker').max(thisEndDate);
}
},
onSave: function () {
this.projectDataSource.sync(); // -- synchronize the datasource when click the save button..
}
});
The above code works properly both in add and update.
How to handle the response?... My response object looks like {Success: true, Message: 'Record successfully updated...' }
Note: I m able to access the response using jquery ajax but i want to access only when datasource sync
Thanks in advance,
Ramesh