Skip to Content

Initial Filter SmarTable SAPUI5

Apr 13 at 06:32 PM


avatar image
Former Member

I'm trying to set an initial sort for the SmarTable component, but it's only applied visually. Below is my code.View:
<smartTable:SmartTable entitySet="CustomerOrders" id="tbOrders" tableType="Table" useExportToExcel="true" beforeExport="onBeforeExport"
				header="Ordens de Manutenção" showRowCount="true" enableAutoBinding="true" beforeRebindTable="onBeforeRebindTable"

onBeforeRebindTable: function(oEvent) {
    var oSmartTable = oEvent.getSource();
    if (this._isOnInit == null) this._isOnInit = true; //To set this initial sorter only when view start
    if (this._isOnInit) {
            sort: {
                sortItems: [{
                        columnKey: "PriorityName",
                        operation: "Ascending"
        this._isOnInit = false;

But only show the order icon and.

The correct order:
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Desiree Matas
Apr 16 at 10:13 AM

Hi Marcos,

What do you mean with "but it's only applied visually"? I understand the sort is applied but not in the way you want? What is the behavior and the expected one? The SAPUI5 version you are using would be useful too.

Best regards,


Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Desiree.
I mean that the sorter has only applied visually because they put a sorter icon in the column header, but does not apply the sorter in the rows in table. The first screenshot is how the table gets when I do it the way it is in the code. Already the third image is the result that would wait with the sorter.

Former Member

Now i add this to the onBeforeRebindTable method and worked 100%, thanks to guy in stackoverflow.

var oParameters = oEvent.getParameter("bindingParams");
				oParameters.sorter = [
					new sap.ui.model.Sorter("DateOpen", false),
					new sap.ui.model.Sorter("PriorityId", false),
					new sap.ui.model.Sorter("HourOpen", false)