Page 1 of 1
Hide fields during Master/Detail
Posted: Thu Sep 29, 2022 5:36 pm
by konfuzion
During normal view I'd like to show 10 fields
but during Master/Detail view, just show 3 fields of Master
Example:
/orderslist?showmaster=customers&fk_customer_id=1
I know can use $this->fieldname->Visible = FALSE; and put in pageload server event
But how to separate normal view and Master view? Is there a way to detect if normal view or master view?
If $isShowMaster then {
$this->fieldname4->Visible = FALSE;
$this->fieldname5->Visible = FALSE;
$this->fieldname6->Visible = FALSE;
$this->fieldname7->Visible = FALSE;
$this->fieldname8->Visible = FALSE;
$this->fieldname9->Visible = FALSE;
$this->fieldname10->Visible = FALSE;
}
Re: Hide fields during Master/Detail
Posted: Thu Sep 29, 2022 6:24 pm
by konfuzion
actually can detect by URL, could just do something like this in Page_Load:
$isShowMaster = Get("showmaster");
if $isShowMaster <> "" {
//insert hide code here
}
Re: Hide fields during Master/Detail
Posted: Thu Sep 29, 2022 7:09 pm
by mobhar
You may search in this forum by using getCurrentMasterTable keyword.
Re: Hide fields during Master/Detail
Posted: Thu Sep 29, 2022 8:00 pm
by konfuzion
In Server Events, I tried in Table_Orders / List Page / Page Load:
if ($this->getCurrentMasterTable() == "customers"){
$this->customer_name->Visible = FALSE;
}
but doesn't work. I had to manually delete it from ../view/customersMaster.php
Maybe I put the code in the wrong place?
Re: Hide fields during Master/Detail
Posted: Fri Sep 30, 2022 8:41 am
by mobhar
You should put it in Detail table instead of Master table.
Re: Hide fields during Master/Detail
Posted: Fri Sep 30, 2022 9:30 am
by konfuzion
--MASTER/DETAIL WEB PAGE START--
[CUSTOMERS] MASTER VIEW
FIRSTNAME: Ben
LASTNAME: Cosby
[ORDERS] DETAIL LIST VIEW
ORDER#1 Order created on 2021/5/2
ORDER#2 Order created on 2021/8/14
ORDER#3 Order created on 2022/2/6
--WEB PAGE END--
In PHPMAKER Server Events:
[ORDERS] / List Page / Page Load
if ($this->getCurrentMasterTable() == "customers"){
$this->customer_lastname->Visible = FALSE;
}
Not working... can still see LASTNAME
Re: Hide fields during Master/Detail
Posted: Fri Sep 30, 2022 10:08 am
by mobhar
From your example above, the LASTNAME field is located at Master table, not in Detail table. That's why it won't work.
Re: Hide fields during Master/Detail
Posted: Fri Sep 30, 2022 10:37 am
by mobhar
If you want to customize the Master section by hiding some fields and only show the others, then the closest approach is you may simply use Custom Templates -> Table-Specific -> Master Record Page -> CustomTemplate that belongs to the Master table.
Re: Hide fields during Master/Detail
Posted: Fri Sep 30, 2022 1:07 pm
by konfuzion
Re: Hide fields during Master/Detail
Posted: Fri Feb 10, 2023 10:51 pm
by vuongduongquoc
I've master table: tbl_nks_dk_phieunhapxuatkho
and detail table: TblNksChitietphieunhapxuatkhoUpdatePhieunhapViewList
I want to hide the diengiai field in master table when i go to master/detail add:
..../TblNksChitietphieunhapxuatkhoUpdatePhieunhapViewList?showmaster=tbl_nks_dk_phieunhapxuatkho&fk_id=176
i added this code in Custom Template/Table Specific/Master Record Page/Custom Template of tbl_nks_dk_phieunhapxuatkho Table but it doesnt work.
if ($this->getCurrentMasterTable() == "tbl_nks_dk_phieunhapxuatkho")
{
$this->setFailureMessage($this->diengiai->setVisibility());
$this->lock->Visible = FALSE;
$this->diengiai->Visible = FALSE;
}
Re: Hide fields during Master/Detail
Posted: Sat Feb 11, 2023 8:26 am
by arbei
vuongduongquoc wrote:
$this->setFailureMessage($this->diengiai->setVisibility());
Wrong code.
Re: Hide fields during Master/Detail
Posted: Sun Feb 12, 2023 7:59 pm
by vuongduongquoc
This code does't work.
if ($this->getCurrentMasterTable() == "tbl_nks_dk_phieunhapxuatkho")
{
$this->diengiai->Visible = FALSE;
}
Re: Hide fields during Master/Detail
Posted: Sun Feb 12, 2023 8:07 pm
by mobhar
You should put that PHP code in Page_Load server event, and not in Custom Template/Table Specific/Master Record Page/Custom Template.
If you want to put your code in Custom Template section of Master Table, then you should refer to this documentation.