Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- onSort: function (oEvent) {
- oEvent.preventDefault();
- var oColumn = oEvent.getParameter("column");
- var sOrder = oEvent.getParameter("sortOrder");
- var sortedRows = []; // Sortowanie rosnąco
- var nColumnIndex = Number(oColumn.getIndex());
- var bIsSorted = TableOperations._checkIfSorted(DataManager._oScheduleData.ColumnSet, nColumnIndex);
- if (bIsSorted) {
- if (sOrder === sap.ui.table.SortOrder.Ascending) {
- sortedRows = DataManager._oScheduleData.RowSet.sort(function (oObject1, oObject2) {
- if (oObject1.AssociationRow.results[nColumnIndex].text < oObject2.AssociationRow.results[nColumnIndex].text) {
- return -1;
- }
- if (oObject1.AssociationRow.results[nColumnIndex].text > oObject2.AssociationRow.results[nColumnIndex].text) {
- return 1;
- } else {
- return 0;
- }
- });
- }
- // sortowanie malejaco
- else {
- sortedRows = DataManager._oScheduleData.RowSet.sort(function (oObject1, oObject2) {
- if (oObject1.AssociationRow.results[nColumnIndex].text < oObject2.AssociationRow.results[nColumnIndex].text) {
- return 1;
- }
- if (oObject1.AssociationRow.results[nColumnIndex].text > oObject2.AssociationRow.results[nColumnIndex].text) {
- return -1;
- } else {
- return 0;
- }
- });
- }
- }
- DataManager._oScheduleData.RowSet = sortedRows;
- this._refreshJSONBindings();
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement