yessikameliza

yessikameliza

Drab issue - controller not changing

I was testing that drab library and it worked for me but I have a problem what is in the controller does not change I am doing what is in this link Drab: Server Side User Interface Access of POKE and PEEK counterattack but the initial list that is entered through the controller is not updating me and I do not understand why I am doing the same as in the tutorial, here is my code

 defhandler replace_list(socket, _sender) do
    IO.inspect("entroooo")
    Drab.Live.clean_cache()
    {:ok, payments} = Helpers.list_payments()
    Drab.Live.poke socket, payments: payments
  end

  defhandler replace_in_process(socket, _sender) do
    Drab.Live.clean_cache()
    payments = Helpers.list_transaction()
    Drab.Live.poke socket, payments: payments
  end

controller:

  def index(conn, _params) do
    {:ok, payments} = Helpers.list_payments
    render conn, "index.html", payments: payments
  end

And that’s what happens


I do not change the list that is in the computer but instead enter it at the bottom

index.html.drab:

<button class="button blue-kommit"
        type="button"
        drab-click="replace_list">
    <u>Pending </u>
</button> 
<button class="button blue-kommit"
        drab-click="replace_in_process">
    In_process
</button>
<button class="button blue-kommit"
        type="button">
    Completed
</button>
<br>
<table>
<%= for payment <- @payments do %>
  <%= payment.id %><br>
<% end %>
</table>

Most Liked

grych

grych

Creator of Drab

Hi yessikameliza,
did you get anything while defhandler replace_list(socket, _sender)?

grych

grych

Creator of Drab

And can you show us payments = Helpers.list_transaction() in the defhandler replace_in_process(socket, _sender), please?

OvermindDL1

OvermindDL1

What do you mean by updating me? Are you waiting for a message from something to get an updated list, or..?

Where Next?

Popular in Questions Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
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
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New

Other popular topics Top

joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
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 31525 112
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
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
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