on 03-07-2019 8:10 PM
Hi All,
I have such a problem - sap.m.Select (drop down) is a column of sap.m.Table and I am not able to set property selectedKey dynamically. The reason why I need this - because it might have different preselected values per table row. I will try to illustrate the problem with some coding:
aCells[n] = new sap.m.Select({ //aCells[n] is an array of table columns, part of table row template
Drop down:
selectedKey : "{rowDropdown}", //<---only hard code values work here
items : { path : "/",
template : oItemTemplate,
templateShareable: true }
}).setModel(oModel);
Table:
var oTable = new sap.m.Table({
fixedLayout : false,
columns : aHeader, //<---array of new sap.m.Column()
items: { path : "/",
template : oTemplate,
templateShareable: true } }).setModel(oModelRows);
Every other table column receives different values per row correctly, using the same approch: variables like "{rowCheckbox}", "{rowText}", "{rowDate}", and so on, but this does not work with drop down, I guess because drop down gets a separate model in step before for populating it's values, perhaps that 's why drop down then ignores the variable "{rowDropdown}".
Any ideas how to deal with such issue?
Thanks,
Regards,
Mindaugas
Hi All,
I am closing this thread, because I made it working this way:
1. creating one bing model for a table, which also contains data for each dropdown, means we have an array per row for each dropdown
2. bind the array mentioned in step 1 to a dropdown, for exmple this way:
var templVar = "rowDropdown"; //in my case it's a variable, in this example a constant
var templVarAll = "rowDropdownAll"; //in my case it's a variable, in this example a constant
var oItemTemplate = new sap.ui.core.Item({
key : "{key}",
text : "{text}" });
var oObject = new sap.m.Select({
selectedKey : "{"+templVar+"}",
items : {
path : templVarAll, //***no curly brackets round a variable here***
template : oItemTemplate,
templateShareable: true } });
3. set model mentioned in step 1 to a table
There is no need to give a name to a model, because just 1 model is used anyway.
If someone gets in similar problems and needs more details, let me know please.
Thanks,
Regards,
Mindaugas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you don't have to put dropdown data in the table data, you can just bind to a single list.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
I am not sure on the following: must I set a separate small model to dropdown and then other model to table or can I copy a content of dropdown-model to model of a table and then set one big model to table? I guess this is a source of problems..
Thanks,
Mindaugas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abdul,
is sap.m.select somehow different from this point of view?
I mean, why JSONModelName should be give inside variable template in this case, but works fine for others, like sap.m.input, etc.
Regards, Mindaugas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try below
{JSONModelName>rowDropdown}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dennis,
not really... with these templates "{rowCheckbox}", "{rowText}", "{rowDate}" I am populating table rows with some values in a loop, in fact all work fine without a slash symbol, just a drop down does not work.
Regards,
Mindaugas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.