I am trying to figure out a way to set selectOptions for two selectBox, the problem is they are have a master-datail relationship, I must be able to populate the content of the detail to reflect master changes and persist the selected options on the corresponding model Properties . The values to populate selectBox are coming from a database, so for instance, I have these function to retrieve master and detail SelectOptions:
function getMasterOptions(){
//code to convert retrieved data to array of objects in order to populate SelectOptions
}
function getDetailOptions(masterValue){
//given a masterValue, retrieve corresponding detail options
}
This is my code so far:
var masterEntry = entryFactory.selectBox({
id : 'Master',
label : 'Master',
selectOptions : getMasterOptions(), //populate master options
modelProperty : 'Master'
});
var DetailEntry = entryFactory.selectBox({
id : 'Detail',
label : 'Detail',
selectOptions : // How to do it ?????
modelProperty : 'Detail'
});
I know it is all about set and get functions, I saw the examples, but I could not make it work. I really appreciate some help about this.