Auto Refresh on Dropdown
Auto Refresh on Dropdown
kashifau
Posts: 9Questions: 2Answers: 0
I am using CakePHP. I added a dropdown to my template (https://datatables.net/forums/uploads/editor/rg/xfgh8ofwyfvz.png) and when I select any option some sort of event, perhaps an ajax call is automatically called. Is there a way to stop that or detect what event is being called so I can add logic to it?
Replies
Photo missing in previous post:
That dropdown isn't part of the DataTable, it's a control created in your code, so that means it's going to be something in your code or CakePHP that's generating the event. It might be worth asking on StackOverflow or a forum dedicated to CakePHP,
Colin
I also thought so but when I use
var table = $('#Events').DataTable();
inside a script tag on that page, the auto refresh stops. Is there a way to disable datatables ajax on a particular page?You can reset the URL to an empty string in
ajax.url()
, that would stop it being able to get any more data.Colin
Thanks will try that. There is another related issue on the same page. I am using drop down to filter data and it successfully returns the desired result when I click filter button, but when I click any of the page number the paging is reset to original query and the filtering is lost. I found this link https://datatables.net/reference/api/ajax.reload() but it didn't work.
We would need to see that to understand the flow. We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
I solved the issue using session variables, but would be keen to find another more datatables oriented approach.