Tabulator v2 release

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 :loudspeaker:

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. :partying_face:

To start using it
add the third party dependency TGQCF3WT6FVL2EM2 and switch to the latest tagged version v2.x



Breaking Changes :boom:

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? :see_no_evil:

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: 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 :yawning_face::flushed:

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

16 Likes

I will definitely be giving this a workout in the next week or so!! Thanks @stucork

2 Likes

Thank you @stucork for being so responsive and a great asset to the community. It works great!

2 Likes

HI - I use Tabulator for a while now in many Anvil Apps - and while I did briefly notice the warning, I was too busy/lazy and didn’t do anything. Now as of this week I am seeing many things break. Is there a quick way to fix if I never ‘pinned’ the old version (not even sure what this means) and I no longer seem to be getting any warning when I open my Anvil apps. thank you!

If you don’t want to update to the new version, then go to the Dependency section in the Settings tab, find the tabulator dependency, switch from Published to 1.0 from the dropdown next to tabulator.

2 Likes

THANK YOU - Got it! Much appreciated

1 Like