Third party dependency | TGQCF3WT6FVL2EM2 |
Github Repo and docs | GitHub - s-cork/Tabulator: Anvil Wrapper for Tabulator |
Live Example | https://example-tabulator.anvil.app/ |
Clone Example | Anvil | Login |
Announcement
The Anvil Tabulator dependency has moved from v1.x
to v2.x
Why?
The Javascript Tabulator Library recently went from version 4 to version 5,
and Anvil Tabulator has been rewritten to takes advantage of those updates.
To start using it
add the third party dependency TGQCF3WT6FVL2EM2
and switch to the latest tagged version v2.x
Breaking Changes
Moving to v2
involves some breaking changes.
See the Change Log.
NB: v1.0.0
will remain the Published
dependency for the next month or so.
After which point, the Published
dependency will move to the latest tagged version.
To ensure your anvil app doesn’t break you should pin the third party dependency to v1.0.0
.
(All those currently using the Published
dependency will see a warning in their logs requesting this change)
What to Expect?
In v2
any Javascript Tabulator option can be included, whereas v1
was limited to what was available from the designer properties.
The API for adding arbitrary options looks like:
self.tabulator.options = {
"selectable": "highlight",
...
}
Similarly any tabulator event can be handled, rather than being limited to those from the designer.
self.tabulator.on("header_click", self.header_click)
And snake case is supported
def tabulator_row_click(self, row, **event_args):
data = row.get_data()
# or row.getData()
Anvil app_tables support
Provide an app_table
in the Tabulator options and the Tabulator component will do the rest.
self.tabulator.options = {
"app_table": app_tables.my_table
}
Now Tabulator will search the table for data and adjust the search query paramaters depending on the header sort.
It fetches data as lazily as an Anvil SearchIterator does
And you can filter the data with anvil query paramaters:
import anvil.tables.query as q
def text_box_change(self, **event_args):
name = self.text_box.text
if not name:
self.tabulator.clear_query()
else:
self.tabulator.set_query(name=q.ilike(f"%{name}%"))
For more details: GitHub - s-cork/Tabulator: Anvil Wrapper for Tabulator