Hello,
i have a big object to be loaded into a datacollection.
This object has some useless data that I’d like to remove from the datacollection.
I’ve tryed this method:
export function getAllAirlines() {
if (allairlines)
return allairlines;
var data = webix.ajax().get("https://raw.githubusercontent.com/npow/airline-codes/master/airlines.json");
allairlines = new webix.DataCollection({
data: data,
scheme: {
$init: function (obj) {
let temp = obj;
obj.id = temp.iata;
obj.value = temp.name;
delete obj.name;
delete obj.alias;
delete obj.callsign;
delete obj.country;
delete obj.active;
}
}
});
console.log(allairlines)
return allairlines;
}
But if I want to remove the entyre object how can I do?
If I assign null to obj, it removes all the next entries.
...
allairlines = new webix.DataCollection({
data: data,
scheme: {
$init: function (obj) {
//BY ADDING THIS
if(obj.iata === "")
obj = null;
...
}
}
});
console.log(allairlines) //i get only 2 record
return allairlines;
}