0
votes

I have a doubt on sapui5 table sorting, I am using the service url to get the data into a tree table and binding the resulted data which i got from the service url.

My question is defaultly it is sorted on the other field, but i want to sort on the base of date field, how could i sort the table before displaying in the table columns using ui.commons controls in xml views

1
It would help if you indicate which table you are using, the sap.m.Table or sap.ui.Table. Their APIs are different. - jpenninkhof
he said tree table, what else Information do you need? can't you sort in the webservice method / backend where you get data from? or is it during runtime? - dotchuZ
Hello jpenninkhof, as i am using sap.ui.table.. i knew while using sap.m. table we can directly pass sorter field in the items.. - Vikky

1 Answers

2
votes

You will need to use sortProperty of sap.ui.table.Column

sortProperty Specifies the binding property on which the column will sort.

For example, if you want to sort table based on Name property.

<t:columns>
    <t:Column sortProperty="Name" sorted="true" >
        <t:label>
            <Text text="Name" />
        </t:label>
        <t:template>
            <Text text="{Name}"></Text>
        </t:template>
    </t:Column>
</t:columns>