xml - SAPUI5 Table total row at bottom -



xml - SAPUI5 Table total row at bottom -

i using sap.ui.table display columns of data. there 12 rows of info - info loaded ajax phone call database. total row @ bottom of columns. can't find examples show totals columns.

here little snippet of table in xml view.

<table:table id="comprecs" visiblerowcount="12" visible="true" rows="{ path:'/yearinfo/' }" navigationmode="paginator"> <table:toolbar> <toolbar> <label id="rectext" text="comparing " ></label> <input id="startyear" width="15%" value="{/startyear}"/> <label id="seltext" text=" "></label> <input id="endyear" width="15%" value="{/endyear}"/> <button text="compare years" press="findrecs"/> </toolbar> </table:toolbar> <table:columns> <table:column > <label text="month" /> <table:template> <text text="{path: 'monthecc',formatter: 'controllers.formatter.month'}"></text> </table:template> </table:column> <table:column > <label text="classified products/components" /> <table:template> <text text="{classproductsa} ({classproductsb})"></text> </table:template> </table:column> <table:column > <label text="classified business partners" /> <table:template> <text text="{classpartnersa} ({classpartnersb})"></text> </table:template> </table:column> </table:columns> </table:table>

what have total @ bottom columns such classified products , partners....these columns showing 2 values - 1 current year, , 1 previous year ('classproductsa' = year 1, 'classproductsb' = year 2).

so should similar to:

month classified products classified partners jan 3 (5) 4 (7) feb 4 (3) 5 (1) totals: 7 (8) 9 (8)

i haven't found examples can try.

edit: sample data:

{"yearinfo": [{"monthecc":"1","classproductsa":"17","classproductsb":"140","classpartnersa":"1161","classpartnersb":"1116"}, {"monthecc":"2","classproductsa":"37","classproductsb":"66","classpartnersa":"1389","classpartnersb":"1112"}, {"monthecc":"3","classproductsa":"60","classproductsb":"66","classpartnersa":"2111","classpartnersb":"1905"}]

shows 3 'months' of info match xml columns above. want:

month classified products classified partners jan 17 (140) 1161 (1116) feb 37 (66) 66 (1389) march 60 (66) 2111 (1905) totals: 114 (272) 3338 (4410)

did seek writing footer table? breadcrumb illustration of table in ui5 explored project has code. have write footer aggregation. write count , have specify elements require parts , set formatter results. data, classproductsa total in label. here code in js. (too bad xml sure work same way)

var totallabel = new sap.m.label({ 'text': {path:'/yearinfo', formatter:function(fullarray){ var classproductsatotal = 0; $.each(fullarray ,function(singleelement){ classproductsatotal = classproductsatotal+singleelement.classproductsa; }); //end of $each. homecoming classproductsatotal; }});

the formatter function have for. path set /yearinfo mean give total array input formatter function .once there,you can loop total.

xml sapui5 totals

Comments

Popular posts from this blog

Using Android Volley to post an array to PHP -

python - How to add an model instance to a django queryset? -

angularjs - No 'Access-Control-Allow-Origin' error from local domain to public API -