Make default edit link master / detail

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

Make default edit link master / detail

Post by DeanAtWork »

Is there a way to make teh default edit link on a list page go to the master detail edit page rather than the normal edit page?


mobhar
User
Posts: 11660

Post by mobhar »

Yes. You may simply use "ListOptions_Rendered" server event that belongs to the List page of your master table.


DeanAtWork
User
Posts: 32

Post by DeanAtWork »

Sometrhing like

$this->ListOptions->Items["Edit"]->Link = "<a href='bllah.php>blah</a>'";

Help file doesnt provide much help for this


mobhar
User
Posts: 11660

Post by mobhar »

Try:

$this->ListOptions->Items["edit"]->Body = "<a href='bllah.php'>blah</a>";

You should refer to the generated code for how to use the link with the recommended css class so that the look and feel of it will be match to the Bootstrap style.


DeanAtWork
User
Posts: 32

Post by DeanAtWork »

Yep did that, here is what i had for anyone else trying to do this

$this->ListOptions->Items["edit"]->Body = "<a class=\"ewRowLink ewEdit\" title=\"\" data-caption=\"Edit\" href=\"assets_with_actions_lat_longedit.php?showdetail=tblDefectDoc&DefectID=" . $this->DefectID->ListViewValue() . "&ActionID=" . $this->ActionID->ListViewValue() . "\" data-original-title=\"Edit\"><span data-phrase=\"EditLink\" class=\"icon-edit ewIcon\" data-caption=\"Edit\"></span></a>";


kirondedshem
User
Posts: 642

Post by kirondedshem »

What other are saying seems straight forward to me as whats important is to create a hyperlink which links to the particular master page and shows the relevant detail pages .where the href="masteredit.php?id=id&showdetail=detail_1,detail_2"
BUT if you prefer to overide the edit link itself then There is an easier way to this.
You will notice that the difference between an edit,view link and a master detail edit link and view link is the url parameter of "showdetail" and by default it looks like "showdetail=", so all you have to do is replace it with "showdetail=detail_1,detail_2" etc separated by commas. You can even assign this to another list option

function ListOptions_Rendered() {
// Example:
//$this->ListOptions->Items["new"]->Body = "xxx";
//add detail links on edit link
$this->ListOptions->Items["edit"]->Body = str_replace("showdetail=","showdetail=detail_1,detail_2",$this->ListOptions->Items["edit"]->Body);
$this->ListOptions->Items["view"]->Body = str_replace("showdetail=","showdetail=detail_1,detail_2",$this->ListOptions->Items["view"]->Body);

}

NOTE:The only downside to this is whenever you add more details you have to add them to the commas list


Post Reply