在SAPUI5表的每一列上添加排序功能

时间:2019-06-11 10:23:49

标签: javascript xml sapui5

我想在表的每一列上添加功能,在该列上单击将按某种顺序对它们进行排序(升/降)。但是列上没有单击事件。每个列上都应显示一个图标,单击该列应打开一个对话框,其中将给出排序选项

<Table id="schTableId" selectionChange="onTableRowPress" 
mode="SingleSelectMaster" growingScrollToLoad="true" growingThreshold="10"
            growing="true">
            <columns>
                <Column >
                    <Text text="Sales Order No." class="ABC"/>
                </Column>
                <Column >
                    <Text text="Creation Date" class="ABC"/>
                </Column>
                <Column minScreenWidth="Tablet" demandPopin="true">
                    <Text text="Requested Delivery Date" class="ABC"/>
                </Column>
                <Column minScreenWidth="Tablet" demandPopin="true">
                    <Text text="Sold-To-Party" class="ABC"/>
                </Column>
                <Column minScreenWidth="Tablet" demandPopin="true">
                    <Text text="Ship-To-Party" class="ABC"/>
                </Column>
                <Column minScreenWidth="Tablet" demandPopin="true" width="8em">
                    <Label design="Bold" text="Product"/>
                </Column>
                <Column minScreenWidth="Tablet" demandPopin="true">
                    <Text text="Quantity" class="ABC"/>
                </Column>
                <Column minScreenWidth="Tablet" demandPopin="true">
                    <Text text="TT No." class="ABC"/>
                </Column>
                <Column minScreenWidth="Tablet" demandPopin="true">
                    <Text text="Invoice No." class="ABC"/>
                </Column>
                <Column minScreenWidth="Tablet" demandPopin="true">
                    <Text text="Invoice Date" class="ABC"/>
                </Column>
                <Column minScreenWidth="Tablet" demandPopin="true">
                    <Text text="Bill Amount" class="ABC"/>
                </Column>
                <Column minScreenWidth="Tablet" demandPopin="true">
                    <Text text="Status" class="ABC"/>
                </Column>
            </columns>
            <items>
            </items>
        </Table>

1 个答案:

答案 0 :(得分:0)

您可以在sap.m.Column控件中使用“ 标题”聚合(默认设置)。您可以在其中放置 HBox ,包括用于显示实际列标题的 Text 和带有排序图标的Button,单击此按钮可以更改排序顺序并修改图标方向。 / p>

https://sapui5.netweaver.ondemand.com/sdk/#/api/sap.m.Column