Hi, I’m sure I’m doing something wrong here so apologies if I’m missing something obvious. I came across this post a while back discussing updating a Kino data table:
I’m my case I simply want to fetch some API data from a form submit and render the retrieved data into a data table. Something like:
# DataTable Updates
```elixir
Mix.install([
{:kino, "~> 0.14.2"}
])
Create a Basic Table
kino = Kino.DataTable.new([])
Now Create a Simple Form
form =
Kino.Control.form(
[
name: Kino.Input.text("Name"),
message: Kino.Input.textarea("Message")
],
submit: "Send",
reset_on_submit: [:name, :message]
)
Kino.listen(form, fn event ->
IO.inspect(event, label: "submit_event")
new_data = [
%{id: 1, name: "Elixir Lang", website: "https://elixir-lang.org"},
%{id: 2, name: "Erlang Lang", website: "https://www.erlang.org"}
]
Kino.DataTable.update(kino, new_data)
end)
form
When running the cells, I can see the table is receiving an update given the number of entries is updated, however, the underlying data doesn’t get displayed as rows in the table as expeted. In reading the earlier thread, it sounded like the addition of update
to Kino.DataTable should handle this, however, I’m unclear as to why it’s not updating the displayed rows. It feels like this should work based on the documentation as well. Does this still need to be added to a DataFrame if I’m updating from a form submit like above?
Thanks for the help!