Page 1 of 1

Make default edit link master / detail

Posted: Mon Nov 13, 2017 7:31 am
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?


Re: Make default edit link master / detail

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

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


Re: Make default edit link master / detail

Posted: Mon Nov 13, 2017 10:29 am
by DeanAtWork

Sometrhing like

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

Help file doesnt provide much help for this


Re: Make default edit link master / detail

Posted: Mon Nov 13, 2017 10:33 am
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.


Re: Make default edit link master / detail

Posted: Mon Nov 13, 2017 11:00 am
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>";


Re: Make default edit link master / detail

Posted: Mon Nov 13, 2017 12:53 pm
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