This topic is locked
[SOLVED]

 step into child record

11/7/2011 9:55:58 PM
PHPRunner General questions
W
wildwally author

Is it possible to step into the child record view page from the parent view with the details.
From the main record veiw I see the child records below, I want to be able to click on the record and go directly to that child record view.php. Much like this code works for the list page.
$("a[id^='viewLink']").bind('click', function() {

window.location.href = $(this).attr('href');

return false;

});

$("tr[id^='gridRow']").click(function(e){

$(this).find("a[id^='viewLink']").trigger('click');

});

C
cgphp 11/8/2011

In the Query tab create an alias for one of the fields of the detail table :

SELECT

field_1,

field_2,

field_3,

field_4,

field_4 as link

FROM detail_table



In the Fields tab, enable the new alias only for the List page.
In the Visual editor set the new alias as "View as Custom" and enter thid code:

$value = "<a href='detailtablename_view.php?editid1=".$data['id_field_of_detail_table']."'>Click here</a>";



If you want to show the link only when you are viewing the master record view, enter this code in the "Before display" event of the detail table:

if(basename($_SERVER['PHP_SELF']) != 'mastertablename_view.php')

{

$xt->assign("link_fieldcolumn",FALSE); //link matches the name of the alias

$xt->assign("link_fieldheadercolumn",FALSE);

}
W
wildwally author 11/8/2011

Perfect, can you point me in the right direction of hiding the dtablelink to all users but admin?
I don't think thats the right name - I tried the $xt->assign("dtablelink_link",false); on before display and no luck.
The link I'm referring to takes the user tot he lsit page of the child records. I only want my users to go to the view.

C
cgphp 11/8/2011

If the alias name is link the right code is:

$xt->assign("link_fieldcolumn",FALSE);

$xt->assign("link_fieldheadercolumn",FALSE);
W
wildwally author 11/8/2011

I was able to get the code you provided working just as explained.
I was looking more so for guidance in how to enable and disable the default child link from PHPRunner. I think I might have found some forum posts on this - is it reffered to as 1showdetail in the PHPR?
One last question and I'll leave you alone for a while - the default buttons such as back to list and the <<<< or >>>>. Is there a guide to the naming on these? Can the functions behind them be reconfigured, or would it be easier to delete them and make my own?

C
cgphp 11/8/2011

It would be easier to delete them and make your own.