Resize page cause reload datatables rails

Resize page cause reload datatables rails

erymicelerymicel Posts: 2Questions: 1Answers: 1

i am using datatables in rails with image in each cell, and that images uploaded by paperclip gem
with #pathroot/uploads URL, my problem is when i resize browser window Rail console shows me just images url keep reloading when inside the datatable ,how can i avoid reloading image over over again when i resize window
Turbolinks - On

Edit: even if declare normal HTML code <img src="example.png" height="42" width="42"> keep reloading when i resize

html file

<table width="100%" id="example">
    <thead>
        <tr>
            <th>Image</th>
        </tr>
    </thead>

    <tbody>
        <% @images.each do |img| %>
            <tr>
<!--                <td><%= image_tag img.file_container.try(:image_url) %></td> -->
                <td><img src="example.png" height="42" width="42"></td>
            </tr>
        <% end %>
    </tbody>
</table>

js file

$(document).ready(function(){
var table = $('#example').dataTable( {
        // bServerSide: false,     i tried different options but could not find
        // deferLoading: 0,
  } );
});

Thanks

Second Edit: if image URL is missing console shows me image trying to keep reload when in datatable if i resize window; ActionController::RoutingError,
if image outside of the datatable console not reloading the error

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,697Questions: 1Answers: 10,102 Site admin

    Can you post a link to a test case showing the issue please.

    Allan

  • erymicelerymicel Posts: 2Questions: 1Answers: 1
    Answer ✓

    I dont have test page, it is on my local, and if image small enough to match column sizes it is not reloading

    and i just found the solution with make this false, so it is restrain to reload images when i resize window now
    https://datatables.net/reference/option/autoWidth

    Thanks

This discussion has been closed.