SAPUI5 Smart Table : How to Inject my own column into smart Table, Default columns, Define formatters, and Define aggregated columns

后端 未结 2 1830
别那么骄傲
别那么骄傲 2021-01-15 04:15

I am Using Smart Table. i want to know the following regarding this,

  1. How Make some columns visible by default
  2. How can we inject our own columns into s
相关标签:
2条回答
  • 2021-01-15 05:00

    To build columns automatically from Service use smart table.
    1.How Make some columns visible by default?
    To get initial column you need specific annotation called LineItem. The fields under this will automatically built by 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.

    Answers to all of this would be build your sap.m.Table and wrap it inside the smart table. By using this the columns built by you will you have custom coded functionality and column built by smart table (for other fields in service)

    0 讨论(0)
  • 2021-01-15 05:06

    XML View

    <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 In Controller you have to set the odata model to the view or smartTable.

    0 讨论(0)
提交回复
热议问题