Changeset 65422 in vbox for trunk/src/VBox
- Timestamp:
- Jan 24, 2017 1:55:14 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 113035
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/VBox/ValidationKit/testmanager/webui/wuicontentbase.py ¶
r65352 r65422 940 940 return sNavigation; 941 941 942 def _isSortingByColumnAscending(self, aiColumns): 943 """ Checks if we're already sorting by this column in ascending order """ 944 # Just compare the first sorting column spec for now. 945 #if self._aiSelectedSortColumns is not None and len(aiColumns) <= len(self._aiSelectedSortColumns): 946 if len(aiColumns) <= len(self._aiSelectedSortColumns): 947 if list(aiColumns) == list(self._aiSelectedSortColumns[:len(aiColumns)]): 948 return True; 949 return False; 942 def _checkSortingByColumnAscending(self, aiColumns): 943 """ 944 Checks if we're sorting by this column. 945 946 Returns 0 if not sorting by this, negative if descending, positive if ascending. The 947 value indicates the priority (nearer to 0 is higher). 948 """ 949 if len(aiColumns) <= len(self._aiSelectedSortColumns): 950 aiColumns = list(aiColumns); 951 aiNegColumns = list([-i for i in aiColumns]); 952 i = 0; 953 while i + len(aiColumns) <= len(self._aiSelectedSortColumns): 954 aiSub = list(self._aiSelectedSortColumns[i : i + len(aiColumns)]); 955 if aiSub == aiColumns: 956 return 1 + i; 957 if aiSub == aiNegColumns: 958 return -1 - i; 959 i += 1; 960 return 0; 950 961 951 962 def _generateTableHeaders(self): … … 962 973 elif iHeader < len(self._aaiColumnSorting) and self._aaiColumnSorting[iHeader] is not None: 963 974 sHtml += '<th>' 964 if not self._isSortingByColumnAscending(self._aaiColumnSorting[iHeader]): 975 iSorting = self._checkSortingByColumnAscending(self._aaiColumnSorting[iHeader]); 976 if iSorting > 0: 977 sDirection = ' ▴' if iSorting == 1 else '<small> ▵</small>'; 978 sSortParams = ','.join([str(-i) for i in self._aaiColumnSorting[iHeader]]); 979 else: 980 sDirection = ''; 981 if iSorting < 0: 982 sDirection = ' ▾' if iSorting == -1 else '<small> ▿</small>' 965 983 sSortParams = ','.join([str(i) for i in self._aaiColumnSorting[iHeader]]); 966 else:967 sSortParams = ','.join([str(-i) for i in self._aaiColumnSorting[iHeader]]);968 984 sHtml += '<a href="javascript:ahrefActionSortByColumns(\'%s\',[%s]);">' \ 969 985 % (WuiDispatcherBase.ksParamSortColumns, sSortParams); 970 sHtml += webutils.escapeElem(oHeader) + '</a> </th>';986 sHtml += webutils.escapeElem(oHeader) + '</a>' + sDirection + '</th>'; 971 987 else: 972 988 sHtml += '<th>' + webutils.escapeElem(oHeader) + '</th>';
Note:
See TracChangeset
for help on using the changeset viewer.