首页 文章

SAPUI5智能表:如何将我自己的列注入智能表,默认列,定义格式化程序和定义聚合列

提问于
浏览
1

嗨,我正在使用智能表 . 我想了解以下内容,

  • 如何默认显示某些列

  • 我们如何将自己的列注入智能表,就像我们想要根据性别(男性或女性)显示图标一样 .

  • 如何设置像Name(FirstName LastName)这样的聚合列 .

  • 如何在聚合列上定义排序和筛选 .

提前谢谢了 .

2 回答

  • 2

    XML视图

    <core:View xmlns:core="sap.ui.core" xmlns="sap.m" xmlns:smartFilterBar="sap.ui.comp.smartfilterbar" xmlns:smartTable="sap.ui.comp.smarttable" controllerName="smartTable.controller" class="sapUiSizeCompact">          
            <Page id="page" title="Customer Line Items">            
                <smartTable:SmartTable entitySet="Patient" tableType="ResponsiveTable" useExportToExcel="true" useVariantManagement="true" useTablePersonalisation="true" header="Line Items" showRowCount="true" persistencyKey="SmartTableAnalytical1" enableAutoBinding="true">
                    <Table>
                        <columns>
                            <Column>
                                <customData> 
                                    <core:CustomData key="p13nData" value='\{"columnKey": "PatientId","leadingProperty": ["LastName", "FirstName"],"sortProperty": "LastName","filterProperty": "LastName"}'/>
                                </customData>
                                <Label text="Concatenated Name" />
    
                            </Column>
                            <Column>
                                <customData> 
                                    <core:CustomData key="p13nData" value='\{"columnKey": "Status","leadingProperty": "Status","sortProperty": "Status","filterProperty": "Status"}'/>
                                </customData>
                                <Label text="Status" />
    
                            </Column>
                        </columns>
                        <items>
                            <ColumnListItem>
                            <cells>
                                <ObjectIdentifier title="{LastName} {FirstName}"/>
                                <Text text="{Status}"/>
                            </cells>
                        </ColumnListItem>
                    </items>
                    </Table>
                </smartTable:SmartTable>
            </Page>
        </core:View>
    

    Controller在Controller中你必须将odata模型设置为view或smartTable .

  • 0

    从Service使用智能表自动构建列 .
    1.How Make some columns visible by default?
    要获取初始列,您需要名为LineItem的特定注释 . 这下的字段将由smart自动构建 .
    How can we inject our own columns into smart table, like if we want to display the icon based on the gender(male or female). How can we set aggregated columns like Name (FirstName + LastName). How to define the sorting and filtering on Aggregated Columns.
    所有这些的答案都是构建你的sap.m.Table并将其包装在智能表中 . 通过使用这个由您构建的列,您将拥有自定义编码功能和由智能表构建的列(对于服务中的其他字段)

相关问题