SAPUI5 model sorter sort responsive table by multiple columns

谁都会走 提交于 2020-01-30 07:54:08

问题


Hi I have a responsive table with data and I need to sort it using the following two columns

  1. PONumber
  2. PO Line

The problem is the model sort is only working with a single property. How to sort the table data by the above order.

This is my view

<m:Table id="podetailstable" items="{ path: '/PODetails' , sorter: { path: 'PoNumber'  } }">
                                                <m:columns>
                                                    <m:Column>
                                                        <m:Text text="{i18n>poDetails_tablecol_PoNumber}"/>
                                                    </m:Column>
                                                    <m:Column>
                                                        <m:Text text="{i18n>poDetails_tablecol_PoLine}"/>
                                                    </m:Column>

                                                    <m:Column>
                                                        <m:Text text="{i18n>poDetails_tablecol_PoItemQty}"/>
                                                    </m:Column>

                                                </m:columns>
                                                <m:items>
                                                    <m:ColumnListItem>
                                                        <m:cells>
                                                            <m:Text text="{PoNumber}"/>
                                                            <m:Text text="{PoLine}"/>

                                                        <m:Text text="{PoItemQty}"/>



                                                        </m:cells>
                                                    </m:ColumnListItem>
                                                </m:items>
                                            </m:Table>

回答1:


To sort with 2 columns simply add an array of sorter objects:

The below

sorter: { path: 'PoNumber'  }

becomes

sorter: [{
        path: 'PoNumber', 
        descending: false
    }, {
        path: 'PoLine', 
        descending: false
    }]


来源:https://stackoverflow.com/questions/50831698/sapui5-model-sorter-sort-responsive-table-by-multiple-columns

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!