I’ve always used the function beforeprocessing successfully in jquery, now with angular 2 I get this error:
ReferenceError: source is not defined
The source code is as follows:
source: any =
{
datatype: "json",
type: 'POST',
data: this.data,
datafields: this.datafields,
addrow: function (rowid, rowdata, position, commit) {
},
deleterow: function (rowid, commit) {
},
updaterow: function (rowid, rowdata, commit) {
},
cache: false,
root: 'annunci',
id: 'id_annuncio',
url: Constants.Default.ApiEndpoint + "/" + 'annuncio.php',
sortcolumn: 'data_inserimento',
sortdirection: 'desc',
beforeprocessing: function (data) {
source.totalrecords = data.TotalRows;
}
}
some idea?