0
votes

I created a smart table using the columns provided by OData service and the corresponding metadata. I also added the smart variant management to the smart table by setting the properties useVariantManagement, useTablePersonalisation and persistencyKey. I can now see the variant management control and create new variants. So far so good.

However, since there is no way to define the column width in the annotation file for the OData service (or is there?), the columns have a predefined width in the standard variant. Therefore, I am resizing the column widths in the afterRendering event of the smart table to consider the length of the data provided by the OData service. The problem I now face is that by resizing the columns, I am adjusting the standard variant and am therefore getting a modified flag (so it says Standard*).

I can see that it is not possible to adjust or delete the standard variant in the frontend but is there any way to save the new layout as the standard variant in the backend?

1

1 Answers

0
votes

You can overwrite column widths client side in the XML:

<smartTable:SmartTable entitySet="Setname" ...>
    <t:Table alternateRowColors="true" visibleRowCountMode="Auto" selectionMode="MultiToggle">
        <t:columns>
            <t:Column width="5em" sortProperty="Columnname" filterProperty="Columnname" app:p13nData='\{"columnKey": "Columnname", "leadingProperty": "Columnname"}'>
                <t:template>
                    <Text text="{Columnname}"/>
                </t:template>
                <Label text="{/#Setname/Columnname/@sap:label}"/>
            </t:Column>
            ...