Advertisement
Guest User

Untitled

a guest
Dec 11th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. onSort: function (oEvent) {
  2. oEvent.preventDefault();
  3. var oColumn = oEvent.getParameter("column");
  4. var sOrder = oEvent.getParameter("sortOrder");
  5. var sortedRows = []; // Sortowanie rosnąco
  6. var nColumnIndex = Number(oColumn.getIndex());
  7. var bIsSorted = TableOperations._checkIfSorted(DataManager._oScheduleData.ColumnSet, nColumnIndex);
  8.  
  9. if (bIsSorted) {
  10. if (sOrder === sap.ui.table.SortOrder.Ascending) {
  11.  
  12. sortedRows = DataManager._oScheduleData.RowSet.sort(function (oObject1, oObject2) {
  13. if (oObject1.AssociationRow.results[nColumnIndex].text < oObject2.AssociationRow.results[nColumnIndex].text) {
  14. return -1;
  15. }
  16.  
  17. if (oObject1.AssociationRow.results[nColumnIndex].text > oObject2.AssociationRow.results[nColumnIndex].text) {
  18. return 1;
  19. } else {
  20. return 0;
  21. }
  22. });
  23. }
  24. // sortowanie malejaco
  25. else {
  26. sortedRows = DataManager._oScheduleData.RowSet.sort(function (oObject1, oObject2) {
  27. if (oObject1.AssociationRow.results[nColumnIndex].text < oObject2.AssociationRow.results[nColumnIndex].text) {
  28. return 1;
  29. }
  30.  
  31. if (oObject1.AssociationRow.results[nColumnIndex].text > oObject2.AssociationRow.results[nColumnIndex].text) {
  32. return -1;
  33. } else {
  34. return 0;
  35. }
  36. });
  37. }
  38. }
  39. DataManager._oScheduleData.RowSet = sortedRows;
  40. this._refreshJSONBindings();
  41. },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement