Conversation
supportI’m trying to make some columns not sortable and found this… https://datatables.net/forums/discussion/21164/disable-sorting-of-one-column …but I’m not sure how to implement it in the shortcode. I have two columns with the class ‘no-sort’, but am not sure what the next step is. Can you please give an example? Thanks – Lux
Something like this should work: [wp-datatable id="table1"] "columns": [ {"name": "first", "orderable": "false"}, {"name": "second", "orderable": "true"}, {"name": "third", "orderable": "true"}, {"name": "fourth", "orderable": "true"} ], "order": [[1, 'asc']] [/wp-datatable]
Thanks for the response. I wasn’t sure how to add the commands initially but seeing your example cleared it up. I went back to datatables.net and found another solution that works better for my needs. [wp-datatable id="themes"] "columnDefs": [ { "targets": 'no-sort', "orderable": false } ] [/wp-datatable] All I need to do now is figure out how to override the css and add my own, and I’m golden. Any tips/hints? Thanks Lux
Sam Just an FYI. I installed the plugin on my VPS just fine but when I tried to install it on a third party hosting company I got a ‘The plugin does not have a valid header.’ message when I tried to activate it. I did a bit of digging around and found that it was the < and > in the copyright message in plugins/wp-datatable/trunk/wp-datatable.php that was causing the issue. I just removed those two symbols and was able to install just fine. Hope that helps. Lux
Yes, datatables is very flexible there multiple ways how to achieve one think… Thanks for info, I’ve fixed it and released new version.
Something like this should work: [wp-datatable id="table1"] "columns": [ {"name": "first", "orderable": "false"}, {"name": "second", "orderable": "true"}, {"name": "third", "orderable": "true"}, {"name": "fourth", "orderable": "true"} ], "order": [[1, 'asc']] [/wp-datatable]
Thanks for the response. I wasn’t sure how to add the commands initially but seeing your example cleared it up. I went back to datatables.net and found another solution that works better for my needs. [wp-datatable id="themes"] "columnDefs": [ { "targets": 'no-sort', "orderable": false } ] [/wp-datatable] All I need to do now is figure out how to override the css and add my own, and I’m golden. Any tips/hints? Thanks Lux
Sam Just an FYI. I installed the plugin on my VPS just fine but when I tried to install it on a third party hosting company I got a ‘The plugin does not have a valid header.’ message when I tried to activate it. I did a bit of digging around and found that it was the < and > in the copyright message in plugins/wp-datatable/trunk/wp-datatable.php that was causing the issue. I just removed those two symbols and was able to install just fine. Hope that helps. Lux
Yes, datatables is very flexible there multiple ways how to achieve one think… Thanks for info, I’ve fixed it and released new version.