Tabulator: write back to anvil data table

What I’m trying to do:
writing data back from tabulator table to anvil data table:
having an editable cell, that, once filled, should write back to the anvil data table

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

Code Sample:

  def tabulator_cell_edited(self, cell, **event_args):
    """This method is called when a cell is edited"""
    #self.tabulator.set_data()
    self.tabulator.update_data([{id:cell.get_row().get_index(), cell.get_field():cell.get_value()}])
    
    curr_slot=cell.get_row().get_cell("timeslot").get_initial_value()
    
    curr_row = app_tables.plan.get(date=cell.get_row().get_cell("date"),slot=curr_slot)
    
    field=cell.get_field()
    # Set  new value
    curr_row.update(field=cell.get_value())

@stucork i am new here, i was a bit confused about the previous thread closing/my post deleted (Tabulator - with anvil components - #18)
you wrote that i should start a discussion maybe also on github - am not sure about that, since it might be that i am just not experienced enough with your tabulator component and someone can help me out quickly?
i hope the context is understandable from what i wrote above. if not, let me know! :slight_smile:

Hi @jo.ra and welcome to the forum,

It’s not clear what exactly the problem is
Are you getting an error?
Is something not happening?

There’s a small error in your function that I can spot:

self.tabulator.update_data([{id:cell.get_row().get_index(), cell.get_field():cell.get_value()}])

Should be

self.tabulator.update_data([{"id":cell.get_row().get_index(), cell.get_field(): cell.get_value()}])

A clone link is usually best for things like this
One that is small, and demonstrates just the issue you’re facing.

This way it’s much easier for others to see what’s going on beyond the code snippet.

For tabulator issues it’s usually best to post them here:

Discussions · s-cork/Tabulator · GitHub

1 Like

Alright. Will continue the discussion on github after i tried your tweak.

There is no error as such. The app table is just not updated after i try to add/edit data in the tabulator table.…

1 Like

couldnt make it with the suggested edit @stucork .
created a discussion on github: write data back to anvil data table · Discussion #83 · s-cork/Tabulator · GitHub
hope the cloned app link there helps to track down my issue…

Have you seen this?:

Thanks @jo.ra - was very helpful - and i’ve replied in the tabulator discussion you linked to :smile:

1 Like

image

i think your app needs at least the updated dependency to TGQCF3WT6FVL2EM2 for tabulator. and then there are some other errors that i cant understand.
thanks for the reference though, i will check the code out at least!

I’m not getting that error. What browser are you using?

safari, Version 16.1 (18614.2.9.1.12)