Phoenix LiveDashboard - create a live table from data stored in assigns

Hi,

I am trying to extend LiveDashboard with my own page and I would like to create a table that will be based on the data that I have in my assigns.

Is it possible to achieve this using the live_table component?

The problem is that live_table uses row_fetcher to determine rows for the table, and row_fetcher doesn’t take assigns as an argument. I could try to pass them as a state but I feel like that’s not the best idea?

Also, this page is going to be distributed as a separate elixir package so I don’t have an access to the Phoenix core components like table.

I assume that the only way is to write my own component?

You could maybe be sneaky and use the process dictionary to share the data between the LV state and the function being called. Given a function is involved LV cannot change track the data for the table changing anyways. Though can’t you use the function to fetch the data in the first place?

Every second I am fetching a struct with statistics. Some of those stats need to be rendered as tables, some other as plots, and so on, The table is not the only thing I am going to create. In other case I could indeed use row_fetcher

I wrote phoenix_better_table for exposing ephemeral data, as other table packages focus on CRUD setups with a backing store. I would be interested to know if this package is suitable for your use case.

Thanks a lot! I actually ended up writing my own component :slight_smile: