Dunno if it’s the coorect solution but…
I’ve created a function inside the window component: getData(collection)
In the main view (where is the datatable), I call the getdata after the onShow event of the window, sending the collection to the window view:
export default class FlightDetailsView extends JetView {
...
config(){
return {...}
}
getdata(item, datacollection){
console.log(item, datacollection)
}
}
export default class FlightsView JetView {
...
config(){
return {...}
}
init(){
this.win = this.ui({
view:"window",
position:"center",
head:"Window",
close: true,
modal: true,
body: FlightDetailsView
});
}
ready() {
// have to wait the render of the grid beacuse otherwise it raises an error
$$("flightsGrid").attachEvent("onAfterRender", function(){
$$("FlightDetailsView").bind($$("flightsGrid"));
});
this.win.attachEvent('onShow', ()=>{
console.log(this.getGrid());
let item = this.getGrid().getSelectedItem();
$$("FlightDetailsView").$scope.getData(item, this.getGrid().data);
});
//... other code to handle the show of the window
}
}
If someone wants to check the code, any advice is welcome