This topic is locked

hide columns on list view

2/14/2014 10:13:56 AM
PHPRunner General questions
W
wfcentral author

I have a client who has a list page with 20 columns. They have asked me if I can have it only show 10 with the option to turn on the other 20 when needed. So, it would be like having a simple view and a detailed view.
The obvious solution would be to create a custom view.
However, here is where that becomes an issue.
Let's say this is a product list.
I already have 6 views of the product list for Owner, Manager, Reseller, Distributor, Part-Time, etc. So they can each have their own view.
Now if I am going to make a simple/detailed view for each of those I'm going to need 12 views. And if he decides to add a column later I have to fix it in 12 places.
So, is there a way to somehow pass a variable that tells the page to show details and have those columns appear when that variable is present?

P
procheck 2/14/2014

I just completed this task. Create a table to keep track of your columns. Set it to 0 as a default to show it and 1 to hide it.

In BeforeShowList, use $xt->assign("fieldname_fieldheadercolumn",false); to hide the header. In BeforeMoveNextList,

use $row["Notes_fieldcolumn"]=false;.
You will need to setup a common link field between this new table and your customer table. Your new screen can have a checkbox

to turn your screens on and off.