Officially it is not supported yet. The assumption is that a custom widget should know very little about the table it is used on. The dependency is inverted here, widget should inform Grist what columns it expects and Grist should map those columns back. You can read more about column mappings here Custom - Grist Help Center
But if you really need to get this information, you can use general API exposed to widgets and just query for the metdata. Here is an example how the Calendar widget is doing it:
This has resolved my issue. Unfortunately, I need to query the column information, as the widget I’m building is meant to work with different types of tables, with an arbitrary amount of columns. Perhaps this is something that could be officially supported in the future?
I’m including what I’ve ended up doing below in case it’s helpful to others. (Get all columns and their details, for the selected table)
Thank you!
I had already discovered how to fetch all data… but it was coming either from all tables or from the first table in the list of tables.
I mean, when fetching table IDs, you get a list of tables but it doesn´t show WHICH table you are connected to. There was no way to discover it.
I wanted that so I would be able to get metadata of the table I am connected to to discover the types of columns, so when editing data I can use the correct type of field (like dropdown, combobox, text field, etc)