Add Grid.set_sort_defaults() method

This commit is contained in:
Lance Edgar 2017-12-04 20:53:46 -06:00
parent 332fadd42e
commit 20bae8e54b

View file

@ -123,6 +123,10 @@ class Grid(object):
def set_sorter(self, key, *args, **kwargs): def set_sorter(self, key, *args, **kwargs):
self.sorters[key] = self.make_sorter(*args, **kwargs) self.sorters[key] = self.make_sorter(*args, **kwargs)
def set_sort_defaults(self, sortkey, sortdir='asc'):
self.default_sortkey = sortkey
self.default_sortdir = sortdir
def set_filter(self, key, *args, **kwargs): def set_filter(self, key, *args, **kwargs):
if len(args) == 1 and args[0] is None: if len(args) == 1 and args[0] is None:
self.filters.pop(key, None) self.filters.pop(key, None)