Page 1 of 1
Hide columns in detail table only when exporting (v2023)
Posted: Fri Apr 26, 2024 11:25 pm
by philmills
I need to hide some columns in my detail table when exporting (pdf and print).
Alternatively if there's a way to remove links in the detail table when exporting that would also be OK.
I tried using this in Page_Load of the Preview page and List page of the detail table:
if (IsExport("pdf")){
$this->myField->Exportable = false;
}
but it doesn't seem to do anything...
Re: Hide columns in detail table only when exporting
Posted: Fri Apr 26, 2024 11:49 pm
by mobhar
Simply change Exportable
to Visible
, and try again.
Re: Hide columns in detail table only when exporting
Posted: Fri Apr 26, 2024 11:55 pm
by philmills
Tried that, it didn't work
I have this in List page
public function pageLoad()
{
//Log("Page Load");
if (IsExport("pdf") || IsExport("print")){
$this->fk_IncidentID->Visible = false;
$this->Filename->Visible = false;
}
}
Re: Hide columns in detail table only when exporting
Posted: Sat Apr 27, 2024 12:22 am
by philmills
Strange - I added this to Page_Load of the generated Grid page and the fields are now correctly hidden from print export, but they are still there in pdf export...
Re: Hide columns in detail table only when exporting
Posted: Sat Apr 27, 2024 2:12 pm
by mobhar
For Export to PDF, you should use isExport()
method that belongs to the current page, instead of IsExport()
global function.
So, your code should be:
public function pageLoad()
{
//Log("Page Load");
if ($this->isExport("pdf") || IsExport("print")){
$this->fk_IncidentID->Visible = false;
$this->Filename->Visible = false;
}
}
Re: Hide columns in detail table only when exporting
Posted: Tue Oct 01, 2024 3:49 pm
by philmills
I need to apply this to a new a new master/detail scenario
I'm exporting from master View with Detail table showing below.
I need to hide some fields in the detail table only from pdf export.
I tried adding it to Grid, Preview and List Page_Load event, and none of them work
if ($this->isExport("pdf")){
$this->fk_StudyPlanID->Visible = false;
$this->id->Visible = false;
$this->fk_School->Visible = false;
$this->Added->Visible = false;
$this->Updated->Visible = false;
}
v2023
Re: Hide columns in detail table only when exporting (v2023)
Posted: Tue Oct 01, 2024 5:31 pm
by sangnandar
I'm exporting from master View with Detail table showing below.
If you're in master View, the context of $this
is the master table, hence $this->(detail table field)
is non-existent.
You can try access detail table fields using $GLOBALS, e.g. $GLOBALS["detail table field"]
Re: Hide columns in detail table only when exporting (v2023)
Posted: Tue Oct 01, 2024 7:11 pm
by philmills
I'm not sure what you mean exactly.
If the master table has multiple detail tables, both tables have an "Added" and "Updated" fields, so surely i need to access both the detail table name and the field name.
what's the syntax for that?
Re: Hide columns in detail table only when exporting (v2023)
Posted: Tue Oct 01, 2024 7:38 pm
by sangnandar
Sorry, $GLOBALS["detail table field"]
should be $GLOBALS["detail table"]->(fieldname)
If you have multiple detail tables, it would be
$GLOBALS["detail table one"]
$GLOBALS["detail table two"]
$GLOBALS["detail table etc"]