on 09-16-2014 4:20 PM
I have a sapUI5 table that has columns using a combo box and a dropdown box control. I'm able to bind the items to the control, select a value and save any selected items to back to the database.
PROBLEM:
I am not able to bind the database data coming in to the controls on the sapui5 table. We are using a flyout filter and changed the bind rows; which we believe caused this issue.
any assistance would be deeply appreciated. thanks KellySioux
VIEW:
var ddWogSizeTarget = new sap.ui.commons.ComboBox("ddMsmWogSizeTarget", {
items: {
path: "/WOGSIZETGT",
template: new sap.ui.core.ListItem({ key: "{WOG_SIZE_TARGET}", text: "{RANGE_DESCR}" })
},
change: function(event) {
oController.rowChange(this, event);
}
});
ddWogSizeTarget.setModel(pps.config.ppsODataModel);
ddWogSizeTarget.bindProperty('value', 'WOG_SIZE_TARGET');
oTableMtrlSpc.addColumn
CONTROLLER: *** here I can see the data objects populating. values are there from the database for combo box and drop down control table column, but do not populate.
var oModel = new sap.ui.model.json.JSONModel();
oModel.setData({modelData: data});
gd.bindRows("/modelData");
gd.rerender();
in case combox value entered wrongly then I am setting setValueState("Error") on that particular cell but when doing scroll in table state of cell in moving up and down & showing red border on other cells. any solution?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok...still not able to bind table data to the grid properly. I did notice that the first item my drop down lists items is always selected. Now every row in that cell is populated with the first item on the drop down list and not the table data.
BTW the drop downs are using oDataModel binding in the view and the table grid is using JSONModel in the controller.
Any help is appreciated.....thanks
KellySioux
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kelly,
here is a short but complete example on a ComboBox in a Table.
I hope it helps.
Regards, Frank
var result = new sap.ui.model.json.JSONModel();
sap.ui.getCore().setModel(result);
oJsonData = {
Category_Sales_for_1997 : [
{ CategoryName : "Beverages", CategorySales : "11.11", Currency : "EUR"},
{ CategoryName : "Something", CategorySales : "33.33", Currency : "EUR"},
{ CategoryName : "Confections", CategorySales : "22.22", Currency : "EUR"}
],
Currencies : [
{ Name : "Euro", Code : "EUR"},
{ Name : "Pound", Code : "GBP"},
{ Name : "US Dollar",Code : "USD"}
]
};
result.setData(oJsonData);
// Create the column templates
var nameColumnTemplate = new sap.ui.commons.TextField({
value: "{CategoryName}"
});
var salesColumnTemplate = new sap.ui.commons.TextField({
value: "{CategorySales}"
});
var salesCurrencyTemplate = new sap.ui.commons.ComboBox({
items: {
path: "/Currencies",
template: new sap.ui.core.ListItem({
key: "{Code}",
text: "{Name}"
})
},
value: "{Currency}"
})
var oTable = new sap.ui.table.Table({ // create Table UI
columns : [
{label: "Name", template: nameColumnTemplate },
{label: "Sales", template: salesColumnTemplate },
{label: "Currency", template: salesCurrencyTemplate}
]
});
oTable.bindRows({path: "/Category_Sales_for_1997"} ); // bind the table rows to an array
oTable.placeAt("content"); // place Table onto UI
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 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.