hide column in list page

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

hide column in list page

Post by GT73 »

I need to Hide the column in a list page if there a specific url (/catlist.php?cmd=search&x_Category=2)or the field have a specific value

ew-table-header-cell

// Row Rendered event
function Row_Rendered() {
$myCat = $this->Category->CurrentValue;
//show table for specific category
if ( $myCat == 2 ) {
$this->field1->Visible = FALSE;
}
}

but so hide only a column the header almost visible "ew-table-header-cell"


dsingh
User
Posts: 166

Post by dsingh »

You should also use the same code in Page_Load Event to hide the header of the column.

// Page Load event
function Page_Load() {
$myCat = $this->Category->CurrentValue;
//show table for specific category
if ( $myCat == 2 ) {
$this->field1->Visible = FALSE;
}
}


GT73
User
Posts: 415

Post by GT73 »

I've try in cat_list.php->Page_Load() but don't works I see header


mobhar
User
Posts: 11727

Post by mobhar »

Put that code in "Page_Render" server event instead.


GT73
User
Posts: 415

Post by GT73 »

mobhar wrote:
Put that code in "Page_Render" server event instead.

works but doesn't work with if clauses, why?

don't works
$myCat = $this->Category->CurrentValue;
//show table for specific category
if ( $myCat == 2 ) {
$this->field1->Visible = FALSE;
}

works
$this->field1->Visible = FALSE;


mobhar
User
Posts: 11727

Post by mobhar »

You cannot hide a column in a List Page only for the certain record(s). That's why it won't work. However, you may assign the ViewValue property that belongs to that field to an empty string instead.


GT73
User
Posts: 415

Post by GT73 »

can I filter for url? how to do?

$myUrl = ?;
//show table for specific category
if ( $myUrl == "mypage.php?x_category=2" ) {
$this->field1->Visible = FALSE;
}


mobhar
User
Posts: 11727

Post by mobhar »

mobhar wrote:
You cannot hide a column in a List Page only for the certain record(s).


Post Reply