I'm developing a SAPUI5 application and having some problems to set a initial Sort for a SmartTable. Tryed this Sapui5: How can I set an initial sort order in smarttable? but not worked.
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"
initiallyVisibleFields="PriorityName,OrderTypeType,OrderTypeName,Id,DateOpen,HourOpen,BrandName,EquipmentId,EquipmentNumber,SymptomName"
class="sapUiResponsiveContentPadding">
Controller:
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) {
oSmartTable.applyVariant({
sort: {
sortItems: [{
columnKey: "PriorityName",
operation: "Ascending"
}
]
}
});
this._isOnInit = false;
}
But the sortering is only applied visually like these images. 1
The correct order is like this. 3