I need to manipulate data returned from service before it loads into grid. Meaning I need to delete some object so that it can not be displayed in the grid.
Here's the service call. Ad you can see in the code I am trying to delete some rows in "onSuccess" event. But its now working. Please help.
moreGroupsService = new Appery.DataSource(MituService_moreGroups, {
'onComplete': function(jqXHR, textStatus) {
Code: Select all
$t.refreshScreenFormElements("j_0");
},
'onSuccess': function(data) { //console.log(data);
//console.log(data[0].groupID);
for (var i in data) {
var obj = data[i];
if (obj.groupID == 5) {
delete data[i];
}
}
//console.log(data);
return data
},
'onError': function(jqXHR, textStatus, errorThrown) {},
'responseMapping': [{
'PATH': ['$'],
'ID': 'moreGroupsGrid',
'SET': [{
'PATH': ['groupID'],
'ID': 'groupID',
'ATTR': 'value'
}, {
'PATH': ['imageHREF'],
'ID': 'moreGroupsImage',
'ATTR': 'src'
}, {
'PATH': ['name'],
'ID': 'moregroupName',
'ATTR': '@'
}, {
'PATH': ['shortDescription'],
'ID': 'moregroupDesc',
'ATTR': '@'
}]
}],
'requestMapping': [{
'PATH': ['token'],
'ID': '___local_storage___',
'ATTR': 'currentUser_token'
}]
});