Benjamin-Philip

Benjamin-Philip

Live Kino DataTable

I’ve got a GenServer with some tabular data that updates frequently. I would like to be able to render this live data. Presently, the way to go seems to create a smart cell for this, and write some custom JS to render my table. However, Kino.DataTable fits all my needs, and I just need a way of updating it. So, I would like to do this without replicating what’s already there in Kino.DataTable.

How do I render live data with a Kino.DataTable?

Most Liked

josevalim

josevalim

Creator of Elixir

Yes, allowing the data table to be updated would be great.

jonatanklosko

jonatanklosko

Creator of Livebook

You can use Kino.Frame and render new Kino.DataTable into the frame as needed.

jonatanklosko

jonatanklosko

Creator of Livebook

Oh, I assumed you don’t need to re-render so often. The slow re-render is less about Kino.Frame and more about Kino.DataTable, which is rendered inside an iframe (as are all Kino.JS), so it does need to load and run the JS again. If you want the table to quickly react to updates, then it should be a single Kino.JS.Live reacting to events.

We have a lower-level abstraction called Kino.Table, where you have more control over how you query the data, and you can enable a “Refetch” button to re-run the query. However, that’s still not reactive.

The current design of Kino.DataTable is very much static. To make it reactive we could add Kino.Table.update, which would invoke a new callback @callback update(update_arg) to update the state and then re-fetch and broadcast the current page. And then we could add Kino.DataTable.update(tabular) and implement the callback, which would be similar to the current Kino.Table.new and @callback init(init_arg).

cc @josevalim

Last Post!

Benjamin-Philip

Benjamin-Philip

That’s great Cristine!

Where Next?

Popular in Questions Top

Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New

Other popular topics Top

Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New

We're in Beta

About us Mission Statement