Add remove_sorter()
method for grids
This commit is contained in:
parent
3d6cc8a490
commit
abca0115a6
|
@ -353,8 +353,14 @@ class Grid(object):
|
||||||
self.joiners[key] = joiner
|
self.joiners[key] = joiner
|
||||||
|
|
||||||
def set_sorter(self, key, *args, **kwargs):
|
def set_sorter(self, key, *args, **kwargs):
|
||||||
|
if len(args) == 1 and args[0] is None:
|
||||||
|
self.remove_sorter(key)
|
||||||
|
else:
|
||||||
self.sorters[key] = self.make_sorter(*args, **kwargs)
|
self.sorters[key] = self.make_sorter(*args, **kwargs)
|
||||||
|
|
||||||
|
def remove_sorter(self, key):
|
||||||
|
self.sorters.pop(key, None)
|
||||||
|
|
||||||
def set_sort_defaults(self, sortkey, sortdir='asc'):
|
def set_sort_defaults(self, sortkey, sortdir='asc'):
|
||||||
self.default_sortkey = sortkey
|
self.default_sortkey = sortkey
|
||||||
self.default_sortdir = sortdir
|
self.default_sortdir = sortdir
|
||||||
|
|
Loading…
Reference in a new issue