Page 1 of 1
Hide columns in detail table only when exporting
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;
}
}