Creating a Tabulator editor component

What I’m trying to do:

Work with the tabulator dependency and provide Anvil components as custom editors.

I’ve been playing with the example Tabulator app, and it has a favorite color custom editor. I’ve been trying to get that to work first so I know I understand how to structure my Anvil component. I thought I had a good handle on it, but I can’t get the example editor to work.

Here’s the example app: Tabulator v2 release

What I’ve tried and what’s not working:

When I run the example and click on one of the favorite color entries, the editor opens but does not populate with the cell value. My understanding was that the row would be passed into the editor as self.item, so I put a print(self.item) in the FavColor __init__ function, e.g.:

class FavColorCell(FavColorCellTemplate):
    def __init__(self, **properties):
        self.init_components(**properties)
        # item is the row data we can use for data bindings 
        print(self.item)

That always prints out an empty dictionary, and so the editor’s text box does not populate with the current favorite color.

It does work correctly on the way out, if I type in a new favorite color the tabulator row is updated correctly.

Is the example out of date? Is there a new way of getting the tabulator row information into the custom editor? Am I missing something basic entirely?

probably best to report this issue at the tabulator github page.

Switching to version 2.1.3 fixes the issue.
Seems to be a regression in the latest commit.

The custom editors are a little difficult to work with IMO, sticking with the default editors is usually best.
There’s some info in the README docs

GitHub - anvilistas/tabulator: Anvil Wrapper for Tabulator

(edit now fixed on Dev/Published dependency - v2.1.5)

2 Likes