2017-08-30 34 views
0

DEMO如何在sap.m.Table中實現多級合併?

我想在sap.m.Table中實現多級合併。我試圖在第二列中添加mergeDuplicates="true",但它看起來像這樣:

enter image description here

很奇怪。我將第一列的數據添加到第二列:<Text text="{name} {amount} "/>,拆分看起來像我想要的,但如何隱藏{name}數據?

enter image description here

做了一些研究在doc of sap.m.Column,發現mergeFunctionName

您可以在一個字符串參數傳遞給後 「#」 號定的函數。例如「data#myparameter」:

我可以將{name}和{amount}都傳遞給myparameter函數嗎?

回答

0

工作的根本原因是,你應該正確地定義你的sorter你綁定。

items="{ 
     path: '/', 
     sorter: [{ 
        path: 'name', 
        descending: false, 
        group:true 
       }, { 
        path: 'amount', 
        descending: false, 
        group:true 
       }] 
     }" 
+0

http://plnkr.co/edit/vaMRhvCYBsOAxcS9Lso7?p=preview如果數據量相同,仍然無法正常工作,「公共汽車」和「卡車」之間的列2的分離器仍然缺失。 – Tina

+0

@Tina,添加組:添加真實 – Allen

+0

,仍然無法正常工作。更新了演示。作爲文檔說:https://sapui5.hana.ondemand.com/#/topic/c4b2a32bb72f483faa173e890e48d812 – Tina

0

使用mergeNameFunction是很好的方法:)你可以使用任何綁定的內部方法來強制比較。

E.g.

<Column mergeDuplicates="true" mergeFunctionName="getBindingContext"> 
    <Text text="column2"/> 
</Column> 

將沒有其他修飾

+0

試過了,似乎不工作。我想要第2列合併:http://plnkr.co/edit/gZuFyay7E2vFwNXqzvL3?p=preview – Tina