Styling content within datatables after Datatables updates
Styling content within datatables after Datatables updates
I have a table that contains various elements - specifically drop downs. Im using select2 for these dropdowns and have various styles applied.
Im using datatables in DOM mode - the table data is sent back to the client and datatables is overlaid on top to provide all its functionality.
However, when Datatables paginates the table, sorts the table etc. any drop downs that were not on screen initially, do not get the select2 styling applied (since the jquery selector that selects the elements doesnt get re-run).
Question: Is there a hook in datatables that will notify me whenever Datatables is changing the displayed data on screen so that I could add in a $('select).select2() invocation on the table?
Regards
Nick
Im using datatables in DOM mode - the table data is sent back to the client and datatables is overlaid on top to provide all its functionality.
However, when Datatables paginates the table, sorts the table etc. any drop downs that were not on screen initially, do not get the select2 styling applied (since the jquery selector that selects the elements doesnt get re-run).
Question: Is there a hook in datatables that will notify me whenever Datatables is changing the displayed data on screen so that I could add in a $('select).select2() invocation on the table?
Regards
Nick
This discussion has been closed.
Replies
Just click on the next page link - none of the selects get styled since the select2 JS doesnt execute on the table page change - so how do I hook in to (or can I) the rendering of the datatable so that I can reapply the select2 styling?