【发布时间】:2015-04-09 15:16:01
【问题描述】:
我正在使用 sap.ui.table 来显示数据列。只有 12 行数据 - 数据从 ajax 调用加载到数据库。我想在列的底部有一个总行。我找不到任何显示列总数的示例。
这是我在 XML 视图中的表的小 sn-p。
<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=" to "></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>
我想做的是在分类产品和合作伙伴等列的底部显示一个总计......这些列显示了两个值 - 一个用于当前年份,一个用于上一年( 'classproductsA' = 第 1 年,'classproductsB' = 第 2 年)。
所以它看起来应该类似于:
Month Classified Products Classified Partners
January 3 (5) 4 (7)
February 4 (3) 5 (1)
Totals: 7 (8) 9 (8)
我没有找到任何可以尝试的示例。
编辑:示例数据:
{"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"}]
显示 3 个“月”的数据以匹配上面的 XML 列。所以会想要:
Month Classified Products Classified Partners
January 17 (140) 1161 (1116)
February 37 (66) 66 (1389)
March 60 (66) 2111 (1905)
Totals: 114 (272) 3338 (4410)
【问题讨论】: