wordpress wp_list_table child rows

I am Learning wordpress and I am creating a plugin that allows me to create some categories and to create some sub categories to link to the catgeories.
At the moment, I am using wp_list_table to get the data from the database into a table. I have a page that shows me the Categories, and an action for each rows that redirect me to another page that shows me another table with the sub-categories link to the main Category.
What I would like to do is to have only one table with all my categories and a button on each row that shows child rows with the sub-categories. I haven’t found any way to do it with wp_list_table, do you have an idea of what I can do, or if I have to implement my own solution. Thank you for your help!

I think you would be looking at developing a jQuery app to do this. WP already prefixes sub categories with an mdash character. You can use this fact in jQuery to hide such rows with CSS. This button in the parent row would trigger another script to remove the hiding CSS only for the rows with mdashes directly below the row with the clicked button.

There will need to be some element walking to get from the element with the mdash up to the element which needs the hiding CSS. Your jQuery could end up being a bit involved. You would still need similar script if you rolled your own list table, though it would be simpler because your table could anticipate the need in its construction instead of having to rely upon mdash characters.

But replicating all the other list table stuff also gets involved. I think it’s only worth rolling your own table if what’s required is much simpler than a WP list table.

Viewing 1 replies (of 1 total)

The topic ‘wordpress wp_list_table child rows’ is closed to new replies.