harleyqmc

harleyqmc

How do you change the order of <Flop.Phoenix.pagination meta={@meta} event=“paginate-whatever” />?

hi

hate to ask such a remedial question but how do you change the order of

<Flop.Phoenix.pagination meta={@meta} event=“paginate-whatever” />

so the output is

previous 2 3 4 5 next

instead of the default that looks like this

i tried as many options as i could work out from here

but didnt get far

any help if you could

thanks in advance

Marked As Solved

sodapopcan

sodapopcan

First off: What Ben said! Does your CSS work at all??

Otherwise, if you aren’t using Tailwind, that is likely exactly what Flop.Phoenix.pagination would look like.

These are my [relevant] pagination opts (using Tailwind):

  defp pagination_opts do
    [
      wrapper_attrs: [class: "flex justify-between"],
      pagination_list_attrs: [class: ["flex gap-4 order-2"]],
      previous_link_attrs: [class: "order-1 hero-chevron-left-mini"],
      next_link_attrs: [class: "order-3 hero-chevron-right-mini"]
      page_links: {:ellipsis, 5}
    ]
  end

image

You can use that that helper function like so:

<Flop.Phoenix.pagination opts={pagination_opts()} meta={@meta} path={@path} {@rest} />

EDIT (which includes much deletion):

If you aren’t using Tailwind then please see @woylie’s answer.

Also Liked

harleyqmc

harleyqmc

oopsie… sorry for the confusion there… tailwindcss is working… i wanted a visual aid but wasnt at the machine where i was having the issue so i just stole that from the github pages…

this most definitely worked

def pagination_opts do
[
wrapper_attrs: [class: “flex justify-between”],
pagination_list_attrs: [class: [“flex gap-4 order-2”]],
previous_link_attrs: [class: “order-1 hero-chevron-left-mini”],
next_link_attrs: [class: “order-3 hero-chevron-right-mini”],
page_links: {:ellipsis, 3}
]
end

id never heard of this order attribute… frontend isnt exactly my jam

badass though… thanks for the help… maybe this will benefit someone in the future

sodapopcan

sodapopcan

Ah, yes, thank you. I was trying to keep my answer complete while trying to remember what it was like to live in the pre-utility class world where I spent 20+ years.

PS, thank you so much for Flop :heart:

Where Next?

Popular in Questions Top

New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
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
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

Other popular topics Top

lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29603 241
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
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31013 112
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 43757 214
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
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement