Master/Detail (v2022)

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

Master/Detail (v2022)

Post by gargiulo »

Hi,

i'm using V2022 and i'm trying to solve 2 issue w/o results, i hope you'll be able to address me. Thanks in advance for help.

I have a master table and several detail tables linked to it :

1- when i'm in list page of master table the dropdown menu of every single row offers the options view, delete, add, master/Detail view. I'd like to hide the view option
2- on the single row of the Master table list i'd like offer to the User the opportunity to double click on the row to open the master/Detail view. After reading several posts i put on the StartUp script of page list the below code

$(function() {
$(".ewTableRow, .ewTableAltRow").dblclick(function(){
window.open($(this).find(".ewRowLink.ewDetailView").attr('href'), '_self');
});
});

but nothing happened

Is there someone who could help me

thanks


arbei
User
Posts: 9384

Post by arbei »

  1. To disable the View page, just uncheck "View" from the Table Setup,
  2. Your CSS selectors are out-dated, you may inspect HTML element in your browser to find the correct CSS selector.
  3. The code your posted above tries to open a new window, are you sure that is what you want? If you search this forum, check the date of the topic, if too old, they may not be valid anymore.

gargiulo
User
Posts: 49

Post by gargiulo »

Thanks, on the first point i already uncheck View in table setup but disappear also Master/Detail view option which is important to me, i'd like to hide only the view option.

About point 3 you are right , code is old , do you have an alternative suggestion in order to open directly the master detail view using double or single click on the row


arbei
User
Posts: 9384

Post by arbei »

First, try the understand why the old code used $(this).find(".ewRowLink.ewDetailView").attr('href'), then find the same URL in the current version. To view HTML source, you may inspect HTML element. Then you may set the window.location as the URL to go to that page.


gargiulo
User
Posts: 49

Post by gargiulo »

Thanks, it worked based on your useful teacher's suggestions and arrived at solution which i share in case someone else has same needs.
To open the Master/Detail view with double click on the list of Master table in V2022 you have simply adopt this short code in Client scripts->List Page->Client script of Master table :

$(function(){
	$('tr:gt(0)').on('dblclick', function() {
		let con=$(this).find('a.ew-detail-view').attr('href');
		window.location=con;
	});
});

the filter gt(0) prevent the double click on the title bar .
Hope could be useful. Thanks again.


Post Reply