Datatables and jQuery initialization

Datatables and jQuery initialization

nrcsantosnrcsantos Posts: 1Questions: 1Answers: 0

Hello,

I've decided to test this nice product but i encounter a small problem.

I'm using Laravel5 and with that i'm using the master pages for the easy theme.
On the 'layout' master page i load all stuff including of course the jQuery.

Now my problem is, since the page where i'm using datatables is in fact called from a route and uses something like:

@section('main')

@stop

This content is reloaded by:

$(document).ready(function() { setInterval(function() { $('#ViewFozzie').load("{{ 'ViewFozzie' }}") }, 1600); });

All works fine but the script doesn't work.
Further check made me realize that unless i call jQuery directly from the file where i'm using the table it doesn't work.
()

So, if i take on my 'master page' on Laravel i will affect the entire website construction that also require jQuery. If i try to run it again it will not work... So...

What can i do??

My page is at: http://tb.cclp.pt/

Answers

  • allanallan Posts: 63,761Questions: 1Answers: 10,510 Site admin

    $('#ViewFozzie').load("{{ 'ViewFozzie' }}")

    That is destroying the old HTML everytime. You would need to reinitialise the table every time since it is a new table.

    A better solution would be to Ajax load the data for the table and use ajax.reload() rather than destroying the table repeatedly.

    Allan

This discussion has been closed.