cancel
Showing results for 
Search instead for 
Did you mean: 

How to change custom column position in smart table

Former Member
0 Kudos

Hi, experts.

I'm having a problem on the creation of a custom column inside a smart table.

Because I have buttons inside of it, it can't come from the backend, as far as I know.

The position of this custom column starts at the beginning of the table, but I want it to be the last column.

This is what I have so far:

<table:SmartTable header="{i18n>Templates}"
          id="idSmartTable"
          showRowCount="true"
          editable="false"
          persistencyKey="smartTablePKey"
          smartFilterId="idSmartFilterBar"
          entitySet="NotificationCollection"
          initiallyVisibleFields="title,collection,updated,Functions,changeType"
          useExportToExcel="false"
          tableType="ResponsiveTable"
          enableAutoBinding="true"
          class="sapUiResponsiveContentPadding">
    <Table class="sapUiSizeCompact">
      <columns>
        <Column popinHAlign="End">
          <customData>
            <core:CustomData key="p13nData" value='\{"columnKey": "changeType","leadingProperty": "changeType","sortProperty": "changeType","filterProperty": "changeType"}'/>
          </customData>
          <Text text="Functions"/>
        </Column>
      </columns>
      <items>
        <ColumnListItem type="Navigation">
          <cells>
            <HBox>
              <Button icon="sap-icon://add" text="Create Deal"/>
              <Text width="10px"/>
              <Button icon="sap-icon://edit"/>
              <Text width="10px"/>
              <Button icon="sap-icon://delete"/>
            </HBox>
          </cells>
        </ColumnListItem>
      </items>
    </Table>
  </table:SmartTable>

And this is the result:

capture2.png

If anyone knows how to solve this issue, it would be of great help.

Thank you.

Best Regards!

Richard Viana

Accepted Solutions (1)

Accepted Solutions (1)

jamie_cawley
Advisor
Advisor

There's an example using columnIndex at

https://sapui5.netweaver.ondemand.com/sdk/explored.html#/sample/sap.ui.comp.sample.smarttable.mtable...

Regards,

Jamie

SAP - Technology RIG

Former Member

Thank you Jamie!

This worked like a charm.

Regards,

Richard Viana

Answers (2)

Answers (2)

former_member374496
Participant
0 Kudos

Hi Experts,

I have similar requirement, i want to make few columns visible in GROUP which is available by default in smart control setting, actually i am able to do that, as i am using <customData>, so i removed "sortProperty" which makes hidden from the Group option, but when i do so, the columns are getting hidden from the SORT also, i need to retain all columns in SORT, but not in GROUP, Please help

a code snippet of custom column:

<Column hAlign="Left">
<customData>
<core:CustomData key="p13nData" value='\{"columnKey": "EVT_DATE","leadingProperty": "EVT_DATE","filterProperty": "EVT_DATE"}'/>
</customData>
<Text text="{i18n>table_Date}"/>
</Column>

Thanks in advance,

Pradeep.

former_member194549
Contributor
0 Kudos

Hey Richard,

include the following to value property.

"columnIndex":"XX"

Replace XX with the Index of your column starting by 0. To display the column on the end of the table i suggest 99.

Regards

Simon

Former Member
0 Kudos

Thank you Simon!

Worked perfectly. Didn't know about this property.

Regards,

Richard Viana