Good Day, I am trying the edit the “AddUrl” of detail table. So for example I am currently on the url like
“master_tableview.php?showdetail=detail_table&id=123” and the view shows the all the relevant detail tables
I wish to change the AddUrl on a particular detail list table which is currently says something like
"detail_requestadd.php?showmaster=master&fk_id=123"I have tried putting the $this->AddUrl = “test.php” in every single location i could think of, including what I thought it should have been. “Detail Grid Page → ListOptions_Load” of the detail table. Because that works on a regular list page. Can anyone advise? Thanks.
Could you please reproduce the example by using demo2022 project (case: orders and orderdetails tables), so that the others could test it straightforward?
From the demo project site, open the orders page, pick and order go to it’s master/detail view. On the orderdetails tab below, I want to change the url for the + icon
which currently routes to /demo2021/orderdetailsadd?showmaster=orders&fk_OrderID=123456
As previously mentioned i attempted putting $this->AddUrl = “test.php” in every possible location but no luck
From which page?
- Is it from the Orders List page after you click on small + icon next to its master record that will show a Preview row below the master record, or:
- Is it from the Master/Detail View Page, for example, when you are visiting this page: ordersview/11086?showdetail=orderdetails,orderdetailsextended
Which one?
Your second example. While on the ordersview/11086?showdetail=orderdetails,orderdetailsextended page, i wish to change the AddUrl for the orderdetails tab on the that window.
You may simply put this following code in Page_Render server event that belongs to the List Page of orderdetails table:
if (CurrentPageID() == "view") { // only when the detail table is displayed in View page
global $Language;
$option = $this->OtherOptions["addedit"];
$item = &$option->add("add");
$this->AddUrl = "testadd"; // <-- adjust to your URL
$addcaption = HtmlTitle($Language->phrase("AddLink"));
$item->Body = "<a class=\"ew-add-edit ew-add\" title=\"" . $addcaption . "\" data-caption=\"" . $addcaption . "\" href=\"" . HtmlEncode(GetUrl($this->AddUrl)) . "\">" . $Language->phrase("AddLink") . "</a>";
$item->Visible = true;
}
Make sure after you add the code in that Page_Render server event, you re-generate ALL the script files again.
Wooow. So yeah. That works lol. Thanks. I definitely wouldn’t have figured that out. I guess in certain scenarios it has to be updated via the “Body”?
I suppose I would have to do something similar to this in another similar scenario? I tried changing the “$this->ExportPrintUrl” on the “View” page on a record via “View Page->Page_Render”. When I do a var_dump I see the “$this->ExportPrintUrl” value has changed but the link still does not update on the page.
But when I use “$this->ExportOptions->Items[“print”]->Body” this works. Thanks again.
We still need that code since PHPMaker will render the button (including its link) by using specific Options object.
For example, for Add/Edit button, it uses OtherOptions[“addedit”], for Export to Print (printer friendly), it uses ExportOptions->add(“print”), and so forth.