I enabled Multiple Detail Table option, on master table list page, there is dropdown button Master/Detail -> Master/Detail Edit, How to hide that button?
Multiple Detail Table - Hide Master/Detail Edit Buttons
-
- User
- Posts: 11712
Assume your detail table name is orderdetails, then simply put this following code in ListOptions_Rendering server event that belongs to your detail table:
$orderdetailsGrid->DetailEdit = false; // adjust orderdetails to your actual detail table name
Please see Example 1 of ListOptions_Rendering server event from docs:
Disable Master/Detail-Add/Edit/View, e.g. if the detail table name is "orderdetails".
-
- User
- Posts: 21
How to hide custom button in list page master table based on field value in detail table?
For example:
Master Table
ID Date Total 1 2021-12-05 2000 Detail Table
ID_Detail Detail_ID Type ProductID Qty Price SubTotal Status 1 1 A 1 1 200 200 N 2 1 B 3 5 300 1500 N 3 1 B 8 1 300 300 N
based on the example above, if type = A and status = N, then the custom button does not appear, but if type = A and status = Y, then the button appears. I just need to check the status value with type A only.
Is it possible? Thank you.
-
- User
- Posts: 21
mobhar wrote:
What did you mean by custom button in list page master table? Please
explain it in more detail, so others could help you straightforward.
I created a custom button on the list page using listoptions_load,
$item = &$this->ListOptions->add("approve");
and in listoptions_rendered:
$this->ListOptions->Items["approve"]->Body ="HTML code button";
How do I get the button to appear if the status of type A is = Y?
-
- User
- Posts: 11712
Qilsh2 wrote:
if type = A and status = N, then the custom button does not appear, but if type = A and status = Y, then the button appears.
Change your code in ListOptions_Rendered server event to:
if ($this->Type->CurrentValue == "A" && $this->Status->CurrentValue == "Y") {
$this->ListOptions->Items["approve"]->Body ="HTML code button";
} else {
$this->ListOptions->Items["approve"]->Body =""; // hide the button
}