diff --git a/tailbone/grids/core.py b/tailbone/grids/core.py index bc7c6684..75c2ffd5 100644 --- a/tailbone/grids/core.py +++ b/tailbone/grids/core.py @@ -76,6 +76,7 @@ class Grid(object): enums={}, labels={}, assume_local_times=False, renderers={}, invisible=[], extra_row_class=None, linked_columns=[], url='#', joiners={}, filterable=False, filters={}, use_byte_string_filters=False, + searchable={}, sortable=False, sorters={}, default_sortkey=None, default_sortdir='asc', pageable=False, default_pagesize=20, default_page=1, checkboxes=False, checked=None, check_handler=None, check_all_handler=None, @@ -119,6 +120,8 @@ class Grid(object): self.use_byte_string_filters = use_byte_string_filters self.filters = self.make_filters(filters) + self.searchable = searchable or {} + self.sortable = sortable self.sorters = self.make_sorters(sorters) self.default_sortkey = default_sortkey @@ -241,6 +244,15 @@ class Grid(object): kwargs['label'] = self.labels[key] self.filters[key] = self.make_filter(key, *args, **kwargs) + def set_searchable(self, key, searchable=True): + if searchable: + self.searchable[key] = True + else: + self.searchable.pop(key, None) + + def is_searchable(self, key): + return self.searchable.get(key, False) + def remove_filter(self, key): self.filters.pop(key, None) diff --git a/tailbone/templates/grids/buefy.mako b/tailbone/templates/grids/buefy.mako index 5ef15a17..0801bbe8 100644 --- a/tailbone/templates/grids/buefy.mako +++ b/tailbone/templates/grids/buefy.mako @@ -187,6 +187,9 @@ % if grid.is_linked(column['field']): @@ -217,7 +220,7 @@ % endif -