jquery-datatables-rails icon indicating copy to clipboard operation
jquery-datatables-rails copied to clipboard

Table in the index page is empty when first rendering.

Open levi-l-damian opened this issue 8 years ago • 2 comments

The table gets populated only after a page refresh is executed. Everything else works. I am following the Rails Cast #340.

Not sure if this is a bug, or I am missing something here. My entire code is here: https://github.com/levi-l-damian/test-dt-mg

If am navigating away form the index page when I am coming back the page is again empty. If I am executing the browser page request, I am getting the table content correctly rendered in the page.

screen shot 2016-05-24 at 6 09 52 am screen shot 2016-05-24 at 6 10 09 am

levi-l-damian avatar May 24 '16 10:05 levi-l-damian

@levi-l-damian Are you using turbolinks. I was facing same issue.When I was hitting a link event was not getting bind and the simple solution was to bind datatable on page load and ready like below.

$(document).on "page:load ready", ->
  datatable_bindings() //This functions initializes my datatable

Hope this helps.

Shwetakale avatar Jul 24 '16 04:07 Shwetakale

It helps, thanks, Levi.

levi-l-damian avatar Jul 24 '16 10:07 levi-l-damian