Multiple Detail Table - Hide Master/Detail Edit Buttons

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
Qilsh2
User
Posts: 21

Multiple Detail Table - Hide Master/Detail Edit Buttons

Post by Qilsh2 »

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?


mobhar
User
Posts: 11712

Post by mobhar »

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".


Qilsh2
User
Posts: 21

Post by Qilsh2 »

How to hide custom button in list page master table based on field value in detail table?
For example:

  1. Master Table

    IDDateTotal
    12021-12-052000
  2. Detail Table

    ID_DetailDetail_IDTypeProductIDQtyPriceSubTotalStatus
    11A11200200N
    21B353001500N
    31B81300300N

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.


mobhar
User
Posts: 11712

Post by mobhar »

What did you mean by custom button in list page master table? Please explain it in more detail, so others could help you straightforward.


Qilsh2
User
Posts: 21

Post by Qilsh2 »

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?


mobhar
User
Posts: 11712

Post by mobhar »

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
}

Post Reply