Wordpress use table sort functionality in own plugin
I'm creating a own plugin for wordpress where I have to view a set of data.
Now I want to use the wordpress default table view to display my data, and give some functionality to it.
default table:
Is there a way to use this 开发者_StackOverflowtable view for my own plugins (some classes or functions) or do I have to create something similar by myself?
I don't believe there is a built "WordPress table view" function. I know someone who uses this same layout in one of his plugins and he simply copied the source code and than made edits where necessary for generating the tables cells etc..
There is a WordPress class (WP_List_Table) as part of the API to achieve these tables documented at http://codex.wordpress.org/Class_Reference/WP_List_Table
You need to extend the class to provide your own data and although not well documented at that URL you can also use views to filter the data (as used in the comment admin page to show All, Pending, approved, Spam and Trash).
here is a simple tut with Example plugin try this one, it uses jquery datatable.
http://kvcodes.com/2014/02/sortable-data-table-wordpress-frontback-end/
and if you want it on your front end try this,
http://kvcodes.com/2014/02/sortable-data-table-wordpress-frontback-end/
hope this will help you.
精彩评论