Which .js file we need to edit for Descending sort while clicking column header

Which .js file we need to edit for Descending sort while clicking column header

iamthekingiamtheking Posts: 5Questions: 2Answers: 0

Hi

For Datatables, descending sort mechanism is there any short code ? My requirement is while clicking the column header i need descending sort rather than ascending as default.

If there is no short code in wordpress, Please let me know which javascript file i need to add the below code.

"columnDefs": [
{ "sorting": [ "desc", "asc" ], "targets": [ "_all" ] }
],

From c-Panel i am confused to update the code as which javascript file i need to add the code snippet.

Another doubt is, is any way to add this update in a separate js file so that even the plugin updates won't affect the changes.

Please help me.
Regards

Answers

  • iamthekingiamtheking Posts: 5Questions: 2Answers: 0

    Can anyone help the above issue I am facing. I have found some files related to the plugin.
    Inside plugins folder, tablepress-datatables-columnfilter/columnfilter.js
    another one plugins/tablepress-datatables-column-filter-widgets/columnfilter.js

    Out of these which file i need to update the code for sort functionality

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    Your columnDefs settings belong in your own DataTables initialization code.

  • iamthekingiamtheking Posts: 5Questions: 2Answers: 0

    Ok, Thank you. I created using wordpress tablepress plugin. This is the reason i am not identifying the javascript file name which is automatically created by wordpress.

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    This blog post might help - it talks about DataTables/Editor and Wordpress.

  • iamthekingiamtheking Posts: 5Questions: 2Answers: 0

    Thank you colin

This discussion has been closed.