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

Where Next?

Popular in Questions Top

9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
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
JulienCorb
I am trying to implement my new.html.eex file to create new posts on my website. new.html.eex: <h1>Create Post</h1> <...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
jaysoifer
Is there a way to rollback a specific migration and only that one ("skipping" all the other ones)? Would mix ecto.rollback -v 2008090...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

Other popular topics Top

chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

We're in Beta

About us Mission Statement