Page 1 of 1

How to hide add and delete button in master Detail table

Posted: Mon Nov 13, 2017 10:00 am
by apis

i have hid master table edit button with th following code:
function ListOptions_Rendered() {
if ($this->Status->CurrentValue == "Saved") {
$this->ListOptions->Items["edit"]->Body = "False";
}

In my master table i have a radio button, "Draft" and "Saved". if the user select "Saved", i want to hide master detail table delete and edit button.

please help.


Re: How to hide add and delete button in master Detail table

Posted: Mon Nov 13, 2017 10:18 am
by mobhar

Change this code:
$this->ListOptions->Items["edit"]->Body = "False";

to:
$this->ListOptions->Items["edit"]->Body = "";


Re: How to hide add and delete button in master Detail table

Posted: Mon Nov 13, 2017 11:00 am
by apis

Mobhar,
Thank you for you reply.
$this->ListOptions->Items["edit"]->Body = "";
sorry it doesnt work for all buttons.

I have a master table and a detail table. In the master table there is a radio button "Draft" or "Saved"
What i want to do is HIDE "edit" and "Addlink" in the MasterDetail table "when the user selects "Saved" in the master table.


Re: How to hide add and delete button in master Detail table

Posted: Mon Nov 13, 2017 1:25 pm
by kirondedshem

$this->ListOptions->Items["edit"]->Body = "False";
THis should be
$this->ListOptions->Items["edit"]->Visible = FALSE;
or
$this->ListOptions->Items["edit"]->Body = "";
to hide edit button in detail isthe same as in any other table. YOu ca get the master id of a detail record at this point as well
function ListOptions_Rendered() {
if ($this->Status->CurrentValue == "Saved") {
//get master id of curent record by using its master_id field of the table
$master_id = $this->master_id->CurrentValue;
//Put condition ased on $master_id
$this->ListOptions->Items["edit"]->Visible = FALSE;
}

To hide an add button from the list age,preview page or list apge of master detail edit page try any of the following
// Page Data Rendering event
function Page_DataRendering(&$header) {
// Example:
//$header = "your header";
//remove default add button from detail list page or preview page
$this->OtherOptions["addedit"]->Items["add"]->Visible = FALSE;

//remove add blank row link during masterdetail edit
$this->OtherOptions["addedit"]->Items["addblankrow"]->Visible = FALSE;

}


Re: How to hide add and delete button in master Detail table

Posted: Mon Nov 13, 2017 3:31 pm
by arbei

apis wrote:
I have a master table and a detail table. In the master table there is a
radio button "Draft" or "Saved"
What i want to do is HIDE "edit" and "Addlink" in the
MasterDetail table "when the user selects "Saved" in the
master table.

If you need to hide the link/button when the user the radio button, you need to add your code in [Edit Tag] -> [client side events] to hide/show the detail table's div.

For example:
<?php if ($this->getCurrentDetailTable() <> "") {?>
if (<condition>) {
$(".ewDetailPages").hide();
}
<?php } ?>


Re: How to hide add and delete button in master Detail table

Posted: Fri Mar 29, 2019 5:47 am
by bkay

To hide an add button from the list age,preview page or list apge of master detail edit page try any of the following
// Page Data Rendering event
function Page_DataRendering(&$header) {
// Example:
//$header = "your header";
//remove default add button from detail list page or preview page
$this->OtherOptions["addedit"]->Items["add"]->Visible = FALSE;

//remove add blank row link during masterdetail edit
$this->OtherOptions["addedit"]->Items["addblankrow"]->Visible = FALSE;

I've tried the above EXACTLY as shown, and seems to make no difference.

Using F12, the class of the button is -
'btn btn-default ew-add-edit ew-add-blank-row' or
'a.btn.btn-default.ew-add-edit.ew-add-blank-row'
(Depending on whether I hover over it with the picker, or look at the code in the side window)

And there are 2 of them, one at the top of the detail, and another at the bottom, both with the same class.

Any other suggestions, or things to try?

Thank you,
Bill


Re: How to hide add and delete button in master Detail table

Posted: Thu May 02, 2019 6:27 pm
by bobmulder5555

kirondedshem wrote:
To hide an add button from the list age,preview page or list apge of master detail
edit page try any of the following
// Page Data Rendering event
function Page_DataRendering(&$header) {
// Example:
//$header = "your header";
//remove default add button from detail list page or preview page
$this->OtherOptions["addedit"]->Items["add"]->Visible =
FALSE;

//remove add blank row link during masterdetail edit

$this->OtherOptions["addedit"]->Items["addblankrow"]->Visible

= FALSE;

}
FYI, I just tried (2018)
//remove default add button from detail list page or preview page
$this->OtherOptions["addedit"]->Items["add"]->Visible = FALSE;

and it works brilliantly in the listview page