Ask A Question

Notifications

You’re not receiving notifications from this thread.

Stimulus Reflex not replacing element?

Pascal Bestel asked in Rails

I have a view that has a search bar and a card deck.

I'm trying to use stimulus reflect to search the card deck and for some reason my card deck is not re-rendering.

Some of my view updated but the majority of it does not?
The @hello updates but the rest does not?

<div class="page-header d-flex flex-row">
    <div class="page-title d-flex flex-grow-1">
        <h1>Wineries</h1>
    </div>
    <div class="search-bar ml-auto">
        <%= bootstrap_form_for '', html: {class: 'search_form no-submit'} do |f| %>
            <%= f.text_field :search_text, hide_label: true, placeholder: "Search", class: 'form-control-lg', append: "<i class='fas fa-search fa-lg'></i>".html_safe,
                             data: {
                                     controller: "catalogue--wineries",
                                     action: "keyup-> catalogue--wineries#search"
                             }
            %>
            <input type="submit" class="sr-only" tabindex="-1">
        <% end %>
    </div>
</div>
<div class="d-flex flex-column">
    <%= @hello %>
    <div class="d-flex flex-row flex-row-reverse mt-2">
        <sub id="winery-count">Showing <%= @count %> of <%= @total %></sub>
    </div>
    <div class="card-deck winery">

        <% @wineries.each do |winery| %>
            <%= render partial: 'app/catalogue/admin/wineries/winery_card', locals: {winery: winery} %>
        <% end %>
    </div>
</div>
Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 87,563+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.