on 08-25-2015 4:10 PM
Hi Experts,
In SAPUI5, there is no APIs to change anything of the table cell itself.
The following code is aimed to modify the style of the td cell and control in the cell, but both of them adds style class to the control, not td cell.
Could anyone indicate how to change td cell style in a table?
editableFormatter: function(v, control) {
if(sap.ui.getCore().byId("btnEdit").getText()==="Edit") {
control.getParent().getCells()[2].addStyleClass('readonly');
control.addStyleClass('readonly');
}
}
The top one is what I need by modifying html in debug tool.
The bottom one is current implementation.
B.R.
Mingquan
Hi Mike,
Hope this helps - JS Bin - Collaborative JavaScript Debugging
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
please check the one in bold
oTable.addEventDelegate({
onAfterRendering: function() {
this.getItems().forEach(function(item) {
var o = item.getBindingContext().getObject();
var dom = $(item.$().find('TD:nth-child(4)'));
console.log(o);
if (o.Salary < 2000) {
dom.addClass('green');
} else if (o.Salary < 20000) {
dom.addClass('yellow');
} else {
dom.addClass('red');
}
});
}
}, oTable);
Here is the equivalent when using sap.ui.table.Table
JS Bin - Collaborative JavaScript Debugging
Thanks
-D
Dear all,
I found the td id is like this: id="oTable-rows-row0-col2", could I use jquery to add style class to td like this $('#'+table.getId()+'-rows-row'+i+'-col'+idx).addClass('readonly')?
Array of data in table is in place and column index is given.
for(var i = 0, j = parameters.length; i < j; i++) {
pr = parameters[i];
if(pr.modifiable)
$('#'+table.getId()+'-rows-row'+i+'-col'+idx).removeClass('readonly');
else
$('#'+table.getId()+'-rows-row'+i+'-col'+idx).addClass('readonly');
}
Any risks and any suggestions?
B.R.
Mingquan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
sorry, you are right.
JS Bin - Collaborative JavaScript Debugging
We have to override updateRows function
Thanks
-D
Hi Mike,
If you're using sap.ui.table.Table control. Will this work? - JS Bin - Collaborative JavaScript Debugging
Regards,
Sai Vellanki.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.