Add remove_sorter() method for grids

This commit is contained in:
Lance Edgar 2023-09-21 14:37:33 -05:00
parent 3d6cc8a490
commit abca0115a6

View file

@ -353,7 +353,13 @@ class Grid(object):
self.joiners[key] = joiner
def set_sorter(self, key, *args, **kwargs):
self.sorters[key] = self.make_sorter(*args, **kwargs)
if len(args) == 1 and args[0] is None:
self.remove_sorter(key)
else:
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'):
self.default_sortkey = sortkey