I created a module that I used to generate a custom comboBoxEdit view (lookup/dropdown) , then I used that module in another page (load the component) , and the view created successfully but without data.
To be more clear:
1- Code of my Custom Module
define("UsrDropDownGenerator", ["ext-base", "terrasoft", "sandbox"], function (Ext, Terrasoft, sandbox) {
Ext.define("Terrasoft.configuration.UsrDropDownGenerator", {
alternateClassName: "Terrasoft.UsrDropDownGenerator",
extend: "Terrasoft.BaseModule",
Ext: null,
sandbox: null,
Terrasoft: null,
viewModel: null,
view: null,
init: function () {
debugger;
this.callParent(arguments);
this.initViewModel();
},
initViewModel: function () {
debugger;
var self = this;
this.viewModel = Ext.create("Terrasoft.BaseViewModel", {
values: {
booleanValueColumnList: Ext.create("Terrasoft.Collection")
},
columns: {
booleanValueColumnList: {
type: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
name: "booleanValueColumnList",
isCollection: true,
}
},
methods: {
getColumnList: function (filters, list) {
debugger;
if (list === null) {
return;
}
list.clear();
var columns = {};
for (var x = 0; x < 4; x++)
{
var value1 = {
displayValue: "qq",
value:"1"
};
columns[x] = value1;
}
list.loadAll(columns);
},
simpleFilterColumnChange :function(args){
debugger;
}
}
});
},
render: function (renderTo) {
// This is executed on the module initialization, right after the init method.
this.view = this.Ext.create("Terrasoft.Container", {
items: [
Ext.create("Terrasoft.Container", {
renderTo: renderTo,
items: [
{
width: "300px",
markerValue: "testMarker",
rightIconClasses: ["combobox-edit-right-icon"],
className: "Terrasoft.ComboBoxEdit",
list: {
bindTo: "booleanValueColumnList"
},
prepareList: {
bindTo: "getColumnList"
},
change: {
bindTo: "simpleFilterColumnChange"
}
}
]
})
]
});
this.view.bind(this.viewModel);
return this.view;
},
destroy: function () {
this.view.destroy();
this.viewModel.destroy();
}
});
debugger;
return Terrasoft.UsrDropDownGenerator;
});
2- Code of my page
......
methods: {
onEntityInitialized:function(){
this.callParent(arguments);
var configObj = {
data : [{label : "Name" , description:"hh"},{label:"Age" , description : "10"},{label:"Job" , description : "bb"}]
};
this.sandbox.loadModule("UsrDropDownGenerator", {
renderTo: "centerPanel", //name of the container where visual module view will be displayed
keepAlive: true
});
},
},
The dropdown was created successfully and appeared in the page , but it does not contains any data.
When I click the dropdown , the getColumnList() function executed and the data are saved in the list , but no data appear in UI .
Why the data are not filled in the dropdown , where is the problem in my code?