bigskysoftware/intercooler-js

Anchor tags not working in Datatables

alexanderschillemans opened this issue · 4 comments

Hi

I'm using Datatables to render my HTML table. I have a few columns that I want to dynamically update by using Intercooler.

Lets say this is my layout:

Name Activated? Actions
John Doe Yes Deactivate
Sam Smith No Activate

When I want to click on "deactivate" or "activate", I want the column 'Activated?' to change. I was able to do this succesfully with intercooler, sending a request to the server and then responding with the HTML and telling IC my target column and row.

However, when I started using datatables this anchor tag does not seem to work anymore. The only thing it does when I click it is reloading the page. No requests are being made to my server and no columns are updated. I'm pulling my hair out for a few hours now trying to see why it would do this, but I cannot seem to find a solution.

To be sure my code was OK, I took it out of the datatable and tried to execute it again and then it worked fine! Only when I put it into the datatable again, it stops working.

Does anybody have experience with datatables and intercooler js working together?
Thanks!

1cg commented

Hi Carson

Thanks for the quick response and thinking along with me!

I've tried implementing your suggestion, but it seems the problem is still persisting. The page still refreshes when clicking on a link and there is no request being sent to the server.

I've noticed that no other links are working either in my datatables. I still have some jQuery Ajax calls written inside my code, and linked them with a class.

e.g.

<a class="activate-user">blabla</a>

$('.activate-user').click(function() {
// Ajax call

});

But that doesn't seem to work either anymore. So it seems to me Datatables is just blocking everything there, but why I do not know. Maybe I should post the question over to their forums as well.

Do you've got another idea to solve this?

Cheers
Alexander

1cg commented

Hi Carson

It seems I was using a modified version of Datatables, called KTDatatables. With this plugin, I was not able to make IC work. However, when using the vanilla version of Datatables I'm getting no issues.

I suppose this issue can be called "resolved" because with the regular Datatables I see no problem - only with the modified version which I understand cannot be supported.

Cheers
Alexander