datacollection obj undefined after $init

Hello,
I have a data collection which is populated in this way:

export function loadAllAirports() {
	console.log(allairports)

	if (allairports)
	return allairports;

var data = webix.ajax().get("http://localhost:8081/data/airports.json");
	console.log(data)

	allairports = new webix.DataCollection({
		data: data.then(data => data.json()).then(data => data.filter(obj => {
			if(obj.code == "VIE")
			console.log(obj)
			if(obj.type!=="Airports"){
				return false;
			}
			return true;
		})),
		scheme: {
			// $init: function (obj) {
			//  	obj.id = obj.code;
			//  	obj.value =  obj.name +" ("+ obj.code +")";
			//  	obj.tooltipvalue = obj.name;
			//  },
			$sort:{
				by: "code", dir: "asc", as: "string"
			}
		}
	}); 
	return allairports;
}

Then I have a function that populates another object:

export function getComboAirports(){
	if (comboairports)
	return comboairports;
	var data = [];

comboairports = allairports.waitData.then(() => {
		var names = [];
		if (allairports.data.each){
			allairports.data.each(function(obj, index, test){
				data.push({id: obj.code, value: obj.name +" ("+ obj.code +")"});
			});
		}
		return data;
	});
	return comboairports;
}

I want to move the configuration of the objet (id, value … ) into the load function, and in this function simply extract the json object needed for populating combo box.

But if I uncomment the $init function from the load, the obj if this function:
allairports.data.each(function(obj, index, test){

is undefined…

why?

nice

try to use loadAllAirports().waitData instead of allairports.waitData

Unfortunately nothing changes

try to uncomment $init except first line obj.id = obj.code;
you must not change item’s id after loading.
if you want code to be item’s id then do it before loading.
for example in array filter.

but normally id changing should not cause such error.

Oh ok, I guess I understand the point (or a part of the point)
My object does not have the id, in fact if I print the object into the $init, I see that webix puts an internal ID.

carriers: "2"
city: ""
code: "ZWE"
country: "Zimbabwe"
direct_flights: "3"
elev: null
email: ""
icao: ""
id: 1588585342089 // here
lat: "-19.0133"
lon: "29.1467"
name: ""
phone: ""
runway_length: null
state: ""
test: 1588585342089
type: "Airports"
tz: "Africa/Harare"
url: ""
woeid: "23425004"```

So If I modify the ID key, this action will cause the problem.
But if I work on any other key, this will not cause the problem.

This does not resolve anything actually :) but it's a step...

I keep trying :)