简体   繁体   中英

tablesorter column show/hide functionality

I am wondering whether tablesorter having column show/hide functionality like FlexiGrid does as the following image:

在此处输入图片说明

The users can select the columns that they want to view.

Is there a plugin for that or any workaround?

Thanks.

Well think of the table as an array of data. If you go over every tr within the tbody

You can select its columns by index. Its been a while since Ive done something like this but the basis is just like an array the indexing starts at 0 so you can go down the rows in an each statement. I can't think of a good example off the top of my head, but in cases where I needed to do similar, there was no way I found short of doing an each over every row for every column

col3 row1 index = 2 col3 row2 index = 5 col3 row3 index = 8

if that makes sense for ya. I wish I could offer better at the time.

if your iterate down the line and .hide() the ones equal to that formula you should be able to show/hide the ones according to the ticks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM