cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 Binding list of comboboxes values from a different json tree than the selectedKey binding

miroslav_sedlar
Explorer
0 Kudos

Hello all,
let us assume that we have a json with two trees of values. One tree, let's call it T_DATA contains the information of selected keys for the comboboxes, T_CELLS contain the items for the comboboxes lists.

There would be no problem if the combobox items were in the same tree with the selected key binding, but I can't change the json. Is this data binding possible?

oTable.addColumn(new sap.ui.table.Column({
label: new sap.m.Label({text: "Example"}),
template: new sap.m.ComboBox({
selectedKey: "{SALESORG}",
items: {
path: "???",
template: new sap.ui.core.ListItem({
key: "{V_KEY}",
item: "{V_VALUE}"
})
}
})
}));
oTable.bindRows("/T_DATA");

Thanks a lot!

Accepted Solutions (1)

Accepted Solutions (1)

former_member365727
Active Contributor
0 Kudos

check out this jsbin example below...

http://jsbin.com/weluxof/edit?html,output

Changed sap.ui.table.Table to sap.m.Table

miroslav_sedlar
Explorer
0 Kudos

Thanks a lot! That's it!

Answers (2)

Answers (2)

miroslav_sedlar
Explorer
0 Kudos

I have made a jsbin example.

http://jsbin.com/yihewacipa/1/edit?html,output

This

path: "/T_CELLS/0/T_CELLS/0/T_DDLB",

must be changed.. the first 0 is hardcoded row number and the second 0 means that there can be more comboboxes on the same row.. so the factory function must somehow take into account only those items with the corresponding V_FIELDNAME, but I think I will be able to do this.. The first 0 is somehow impossible for me to solve 😞

thanks!

former_member365727
Active Contributor
0 Kudos

use factory function...

Bind the table to T_DATA then in the factory function during the template creation access T_CELLS to perform binding to combobox.

miroslav_sedlar
Explorer
0 Kudos

Thanks a lot, please have a look at the post below.. I have made a jsbin example, thanks!