cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Dynamically bind data to a Select in Table, depending on another select?

anusree_k_k4
Associate
Associate
0 Likes
473

Hi Experts,

I have a JSONModel as below . I have a table with two sap.m.Select controls and after select in the first one, I would like to have the values in the second one updated. Here the first select will have the text1, text2 and if we select text1 the next select will have text1.1, text1.2 So how can I dynmicaly bind the values of the second select to the correct row.Tried the below in the change event of first select, but doesnot work. How this aggregation can be properly bound?


model =
[{

"key": "key1",
"text": "text1",
"values": [{
"key": "key1.1",
"text": "text1.1"
}, { "key": "key1.2", "text": "text1.2" }] }, { "key": "key2", "text": "text2", "values": [{ "key": "key2.1", "text": "text2.1" },{ "key": "key2.2", "text": "text2.2" }] }]

Accepted Solutions (0)

Answers (1)

Answers (1)

junwu
SAP Champion
SAP Champion

var oBindingCtx=oEvent.getParameters("selectedItem").getBindingContext("model")

this.byId("select2").setBindingContext(oBindingCtx);

this.byId("select2").bindAggregation("items",{

path:"model>values",

template:.......

})

if it is standalone, it should work.

but in your case, you have table, this.byId("select2") it won't give you the dropdown in that cell

probably you have to do

oEvent.getSource().getParent().....then get all cells --->get the target cell