Skip to Content

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

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!

binding2.jpg (62.8 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    May 10 at 04:31 PM

    check out this jsbin example below...

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

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

    Add comment
    10|10000 characters needed characters exceeded

  • May 09 at 09:10 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • May 10 at 09:27 AM

    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!

    Add comment
    10|10000 characters needed characters exceeded