在 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>

您可以在 sap.m.Column 控件中使用">header"聚合(这是默认的(。您可以将HBox放在那里,包括用于显示实际列标题的文本和带有排序图标的按钮,单击该按钮可更改排序顺序并修改图标方向。

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

最新更新