Update dropdown select after ajax reload or setting filter
Update dropdown select after ajax reload or setting filter
Link to example: live.datatables.net/lomevebo/1/edit
I am searching for a way to do 2 things.
1 I need the other select boxes to be updates after one is selected so the other option reduce as they are no longer relevant after selecting. For example I have a colomn with 100 clients and a colomn with months. When I select the month I only need to see the clients presented in that month and visa versa.
2 After I use a update statement from a other ajax submit and call the function: $('#example').DataTable().ajax.reload(null, false);
I need the values in the dropdowns to be updated with the new results.
I have been searching and found the folowing example for questions 1. live.datatables.net/jusidipo/1/edit but i cant get this intergrated in my project/code in the example i got. Is there a simperler way to do this?
Answers
Allan's example from this thread is probably easier to implement. I made two changes to your
initComplete
code. First this:and this, added
.empty()
:Looks like it works here but I haven't tested thoroughly:
http://live.datatables.net/lomevebo/5/edit
Kevin
Hey Kevin,
Thank you for responding. I have a hard time implenting you answer to my project(not a expiernced developer..). See my complete datatable code (example is not running ofcourse, i have no idea how to make a demo for a code as this..).
Where and how do I implent that solution in the code as shown in below link?
live.datatables.net/retiyovu/1/edit
Tried to use your changes to the initcomplete code. Gives the folowing error.
Uncaught TypeError: table.column is not a function
I suspect it's because you haven't set the variable
table
. Try this as the first line in yourinitComplete
function:If that doesn't help, please update the test case to demonstrate the issue,
Colin
Thanks. That seems to work for the changes Kevin proposed. I actualy dont understand what it is suppose to do. As after reload the filter is not refreshed. I did managed to implent the example for question 1 but that kills performance for my project so left that out. So all I use now is the initcomplete function as in the below example. So how to make it reload filter after calling
$('#example').DataTable().ajax.reload(null, false);
live.datatables.net/lomevebo/9/edit