Exemple #1
0
    def sort_by_column(self, col, reverse=False):
        """Sorts the model data by the column indexed by *col*."""
        # Make sure we allow sorts by column:
        factory = self.editor.factory
        if not factory.sortable:
            return

        # Flush the object cache:
        self._filtered_cache = None

        # Cache the sorting information for later:
        self._sorter = self.__get_column(col).key
        self._reverse = reverse

        # If model sorting is requested, do it now:
        self._sort_model()

        # Indicate the we have been sorted:
        self.sorted = True

        self.column_sorted = GridSortEvent(index=col, reversed=reverse)
    def sort_by_column ( self, col, reverse = False ):
        """ Sorts the model data by the column indexed by *col*.
        """
        # Make sure we allow sorts by column:
        factory = self.editor.factory
        if not factory.sortable:
            return

        # Set up the appropriate sorting filter on the model:
        mode = 'ascending'
        if reverse:
            mode = 'descending'
        self.editor._sort_model.model_filter = SortFilter(
                                         filter = self.__get_column_name( col ),
                                         mode   = mode )

        # Indicate the we have been sorted:
        self.sorted = True

        self.column_sorted = GridSortEvent( index    = col,
                                            reversed = reverse )
Exemple #3
0
 def no_column_sort(self):
     """ Resets any sorting being performed on the underlying model.
     """
     self._sorter = self._filtered_cache = None
     self.column_sorted = GridSortEvent(index=-1)