Sorry, we don't support your browser.  Install a modern browser

Jquery to toggle table options & filters#256

?

As a suggestion, I was thinking it would be nice if we could target the the Columns options via Jquery or javascript.

show/hide tablet
show/hide mobile
show/hide the column
turn on/off sorting
show/hide filters
be able to target a filter with a value.
set what column to sort by and direction to sort

that way we could put a button the page as I was asking. That could toggle these options on/off via jquery on the page.

basically create a mechanism for Jquery or javascript to toggle table options, that can be embedded on the page.

That way we would not have to have multiple pages, with multiple queries to see segments of data that are contained in the table. Jquery Datatables library has support what I am talking about https://datatables.net/manual/

I thought as your plugins is similar it have similar features.

maybe something like this

$(‘#example’).wpDataTable( columns: [
{ data: ‘name’ },
{ data: ‘position’ },
{ data: ‘salary’ },
{ data: ‘office’ }
],
sort: [
{column: ‘office’, ‘desc’}
],
filters : criteria :[
condtion: ‘=’,
data: ‘office’,
values: [‘Los Angles’, ‘Burbank’]
}
]
}

} );

So this would toggle the table to only show these 4 columns and then filter the data in the table by the ‘office’ column and show only the two values.

This is just as an example of what I was thinking. So I could create any HTML button or link with id of ‘example’ to trigger the toggle on the table.

a year ago