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
Creator of Drab
grych
Creator of Drab
And can you show us payments = Helpers.list_transaction() in the defhandler replace_in_process(socket, _sender), please?
1
OvermindDL1
What do you mean by updating me? Are you waiting for a message from something to get an updated list, or..?
1
Popular in Questions
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
Hi!
In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir?
Searched the docs for ip address and the web, no good results.
Thanks!
New
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
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
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
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
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
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
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set?
Thanks.
New
Phoenix 1.4.0 released
Phoenix 1.4 is out! This release ships with exciting new features, most notably
with HTTP2 support, improved deve...
New
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
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
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
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex










