fbutano

fbutano

Hi all, I’m trying to maintain a consistent UI by using the standard Core Components <.table> generated by Phoenix (with DaisyUI styling), but I also want to integrate Flop sorting into the headers. At the same time, I’m using LiveView streams (phx-update=“stream”) to update only the table body.
Requirements:
1. Use Flop for sorting, so each header becomes clickable and triggers /admin/users?order_by=email&…
2. Keep the Core Components <.table>, without rewriting the whole table manually.
3. Keep using LiveView streams for the rows so updates are efficient and smooth.

I’ve tried:
• Using <Flop.Phoenix.sort_link> inside label={…}, but that doesn’t work because label expects a string.
• Adding slots like <:label>, but <.table> doesn’t support that.
• Using Flop.Phoenix.table, which supports sorting but does not support phx-update=“stream”, so it doesn’t play nicely with the Core Components setup.

Question:
Has anyone found a clean way to integrate Flop sorting into the Core Components <.table> while still leveraging LiveView streams for the table body—without having to rebuild the table manually?

If you’ve come across a pattern or a component wrapper that does exactly this, I’d love to see it!

Thanks in advance.

First 3 of 3 Posts Switch mode

woylie

woylie

Flop.Phoenix.table supports streams, there’s an example in the readme: LiveView streams. phx-update="stream" is set automatically when a stream is passed to the component. The implementation is very close to the table implementation from CoreComponents.

fbutano

fbutano OP

Thanks a lot for your quick reply, and congratulations on the amazing work you’ve done with this library — it’s a great piece of work!

I’ll definitely give this approach a try with Flop.Phoenix.table and streams. My original question was more about whether there’s a way to somehow inject the sorting into the original Core Components <.table> component, but I’ll try your solution anyway.

One extra question: do you see any drawbacks in replacing <.table> with Flop.Phoenix.table> entirely in a project that uses Core Components everywhere?

Thanks again!

woylie

woylie

I’m using the Flop table for most use cases throughout all projects I’m working on. I still have a simple_table component in CoreComponents for cases where I don’t need pagination, filtering, or sorting. Both components are interchangeable, with the exception of the required Flop.Meta struct.

— All posts loaded —

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
rahultumpala
Hello, I have an Elixir backend that implements a custom protocol over TCP. I want to load test the backend and assess the performance o...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement