Dynamic List View

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
starquest321
User
Posts: 140

Dynamic List View

Post by starquest321 »

I want to give my users the ability to set the columns on their list view. Some will want to display mail, while others will not. I was thinking about a table called listview in which every user adds the fields the he wants to display. Then I somehow select only those fields based on user from the list view. Any ideas?


mobhar
User
Posts: 11905

Post by mobhar »

starquest321 wrote:
Any ideas?

  1. You have to enable all the fields while generating the script files.
  2. Use "ListOptions_Load" and "Row_Rendered" server event to hide the certain columns.

starquest321
User
Posts: 140

Post by starquest321 »

Use "ListOptions_Load" and "Row_Rendered" server event to hide the certain columns.

Can you add to this detailed logic so I can implement?

  1. setup a table called setup_userlistview:

  2. index

  3. field

  4. user

  5. In the customer table I would query the setup_userliview table based on listoptions and render the list? Can you give example of the code line?


danielc
User
Posts: 1599

Post by danielc »

To hide a field in Row_Rendered server event:
if (CurrentPageID() == "list") // assume you want to hide in list page
$this->yourfield->Visible = FALSE;

To get the value from another table:
$value = ew_ExecuteScalar("SELECT yourfield FROM yourtable WHERE your condition"); // only one column will get

See Server event and Client script in help file. Also, you can set Visible property in Page_Load server event for your list page or view page.

You just create the table for user list of preference. Then, you can get the value to set Visible property:
$this->yourfield->Visible = $value; // if $value is greater than 0, it will be true.


Post Reply