Anvil Community Forum

[FIXED] TypeError: Component constructor takes keyword arguments only

All of a sudden my app started experiencing this error when loading a particular component. I am leveraging the Tabulator component, which I have not modified since last October.

The full error is:

TypeError: Component constructor takes keyword arguments only
at app/Tabulator/Tabulator/__init__.py, line 174 column 8
  called from app/Tabulator/Tabulator/__init__.py, line 178 column 8
  called from Main, line 54

Code Sample:

self.content_panel.add_component(Donations())

I am not really sure how to debug, as I don’t have access to the __init__ method of that component.

Hi, have you tried updating the Tabulator component? I have done some updates of tabulator since then that coincide with updates to anvil.

Could you post a clone link of your app. Including the Tabulator dependency you’re using. If you can post the clone link with its dependencies as explained here:

Here’s a link to updating another dependency. Replace the dependency name with Tabulator and it should work.

Ok here is a sample app without any of my data:

https://anvil.works/build#clone:AGFUETG7I2GHXEOR=SNDAGMAM4EMOCAMPARJXD66L

I have narrowed it down to adding those two extra columns on lines 25 and 29 of Form2

Looks to be specifically a problem with the redraw function:

function redraw(self) {
    table = find_table(self);
    table.redraw();
}

Ok so in replacing all my usage of the old dependency with the new one, looks like my problems are now all fixed. Not sure what happened to break my old version.

great - glad it’s fixed. The bug is a little tricky to explain - but essentially when we improved our anvil.js library it meant that anything that was callable in python became callable in javascript.

And there’s a line in the Tabulator source code that calls a function if it gets a function as a formatter. So it was trying to call an anvil Link from javascript where before it would ignore it.

The update to the Tabulator library fixed that bug.

1 Like

Great. Well thanks for staying on top of this stuff. Your libraries are awesome by the way. I am actually in the middle of using the Popover dependency and I am turning the popovers into a single and multiselect component with a search. It’s going pretty well so far!

ah awesome! you should check out this component i’ve been working on:

I keep putting off finishing it.

I started using: GitHub - davidstutz/bootstrap-multiselect: JQuery multiselect plugin based on Twitter Bootstrap.

And then I found: Examples | bootstrap-select · SnapAppointments Developer
Which I think will be better - I just need to get round to updating the implementation to use this library.

There might be some useful code there.

Hahaha I wish this was in my life like 4 days ago. I spent a long time making this: https://anvil.works/build#clone:V6M2LVQKVGJLBKVJ=PCRIAAOHWFJFNWNQR5BE2DNI

I am not as skilled at the javascript stuff, so my code is hacky in places, but it works relatively well. The multiselect is a combination of the token box implementation plus the popovers. I had to modify the popovers code in a couple of places to help with some of the resizing and show/hide functions.

1 Like

Hey so I am having more problems than it’s worth trying to turn popovers into a multiselect. Do you have any advice for implementing that library you linked? Where do I start? Are there resources you used to learn how to translate the popover functions into anvil code?

Here’s the current progress on multiselect:

https://anvil.works/build#clone:YUAZWZ55TECOMZNQ=SVETDNR5WFTSYZDOWINRKDGL

Feel free to use it and let me know if you have any feedback/questions

1 Like

Thanks! I’ll give it a try

This is so much better than was I was trying to do. Thanks, this saves me a lot of time and headache!

1 Like