Hi,
I'm trying to work with the sap.m.Table element and I have a few questions about it. Firstly, I would like to dynamically change the background color of each row of the table based on information from an OData model. I have tried adding it via addStyleClass for each ColumnListItem but that isnt working. I then tried to access the the rows via Javascript but that doesnt work either. Any clues on this? Secondly, I would like to add an tap listener to each row but when I add a tap or press listener to ColumnListItem, it doesnt work.
The code I'm using is:
new sap.m.Table("myTable", {
columns: [
new sap.m.Column({
header: new sap.m.Label({text: "Feature 1"})
}),
new sap.m.Column({
header: new sap.m.Label({text: "Feature 2"})
}),
new sap.m.Column({
header: new sap.m.Label({text: "Feature 3"}),
}),
],
items: {
path: "/DataSet",
template: new sap.m.ColumnListItem({
tap: function(evt) { alert("THIS DOES NOT SEEM TO BE WORKING"); }, //this listener isnt working. is this correct?
cells: [
new sap.m.Text({
text: "{Key}",
}),
new sap.m.Text({
text: "{Value}",
}),
new sap.m.Text({
text: "{Value}",
}),
],
}),
},
}).setModel(model2),
I try to get an element of the page via HTML DOM as follows:
var abc = document.getElementById("__item5-myTable0"); //the id here is the id of the row <tr> in question
alert(abc); //this returns null. something is going wrong here
Any help is much appreciated. Thanks.
