on 07-06-2018 11:10 AM
hi all
i develop one application with odata and fill the table. also i color the row as per entity condition.
i put code in init(), afterrendering, on deligate, table updatefinish.i tried all thing. Color work first time but when try to fillter table then color not working?
need to write any extra code in upfatefinished?
thanks in advance
Hi Nishanth,
How about writing the color code in the table onAfterRendering().
Regards,
Srinivasan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
var oTable = this.getView().byId("tblAllPo");
var aa = oTable.getBinding("items");
var aItems = oTable.getItems();
if (aItems && aItems.length > 0)
{ for (var i = 0; i < aItems.length; i++) {
var aCells = aItems[i].getCells(); // if (aCells[11].getText() === "NEW") { // debugger; // aItems[i].addStyleClass("redBackground"); // } if (aCells[11].getText() === "COMPLETED") { debugger; aItems[i].addStyleClass("greenBackground"); } if (aCells[11].getText() === "PARTIAL") { debugger; aItems[i].addStyleClass("blueBackground"); } if (aCells[11].getText() === "OVERDUE") { debugger; aItems[i].addStyleClass("LightCoralBackground"); } } }
sap.m.table or sap.ui.table ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nishanth,
If you are using sap.ui.table control, you can use the same logic on " Filter Event" for "color the row as per entity condition". So for every filter search, you will able to get "Color the row".
Try to write the "color the row" as a separate function. so that you can use on init() and filter event also.
Regards,
S. Sai Santhosh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
1.png result
If your are using XML view table try to use formatter in your status column cell template.
<Text text="{ path: 'invoice>Status',
formatter: '.formatter.statusText'
}"/>
in the formatter you can add your status color logic with CSS class
statusText: function(v){
if(v === "OVERDUE"){
this.addStyleClass("zStatusRed");
}
return v;
}
This will work for you and working for me.
For more information look at this link.. https://help.sap.com/doc/saphelp_uiaddon20/2.05/en-US/0f/8626ed7b7542ffaa44601828db20de/content.htm?...
s.sai.santhosh
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
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.