I would like to open view of the record when double click on list rows.
I think I should create java script in Client Scripts -> Table-Specific -> List Page -> Startup Script but I'm not knowledgeable yet to link the id record and appreciated if someone can help.
Double click to view a record
-
- User
- Posts: 17
Double click to view a record
-
- User
- Posts: 11737
Assume you are using "trademarks" table from the demo project, then simply put the following code in "Startup Script" that belongs to the List Page:
$(document).ready(function() {
$('tr').dblclick(function(){
var row_id = $(this).attr('id');
var id = $("#" + row_id + " input[name='key_m[]']").val();
window.location = "trademarksview.php?showdetail=&ID="+id;
});
});
-
- User
- Posts: 17
Thank you so much, it works perfectly.
One thing I noticed though that Modal dialog doesn't function anymore and I tried to change windows.location to that pop up window's URL but nothing to be seen and so is there a way to find out ?
-
- User
- Posts: 641
Hi
Where would you add this code? to startup script for the view?
if so like this
$(document).ready(function() {
$(function() {
$(".ewTableRow, .ewTableAltRow").dblclick(function(){
$(this).find(".ewRowLink.ewView").click();
});
});
});
as can not get this to work.
cheers
-
- User
- Posts: 11737
It should work. Make sure you do not include that closing "</script>" tag. That tag should be added while generating the script files by PHPMaker, and not added manually.
Press [F12] in your browser, and see whether any Javascript error message from "Console" tab -> "All" sub-tab.
-
- User
- Posts: 142
I am trying to do the following:
Double click on a record to view the Master Detail view using the following:
$(document).ready(function() {
$('tr').dblclick(function(){
var row_id = $(this).attr('id');
var id = $("#" + row_id + " input[name='key_m[]']").val();
window.location = "AA_RiskDetaillist.php?showmaster=AA_Risk&fk_Risk_Id="+id;
});
});
But the id at the end equals unspecified. So I only see the detail table and not the master.
I put the code in the master table client scripts. When I double click I want to see the master record with the detail list table. Just like when I enable "master/detail view" or "master/detail add"
I am using PHPMaker v2017.
-
- User
- Posts: 11737
Try this:
$(function() {
$(".ewTableRow, .ewTableAltRow").dblclick(function(){
window.open($(this).find(".ewRowLink.ewDetailView").attr('href'), '_self');
});
});
- Make sure you have already put it in "Startup Script" of "List Page" that belongs to the master table,
- Make sure you have already enabled "Master/Detail View (as Detail)" option from "Table" setup -> "Table Options" -> "List Page" that belongs to the detail table,
- Make sure you have already regenerated ALL the script files,
- It should work, as I've just tried it here.
-
- User
- Posts: 361
is there any trick to edit any column by double click without open new page
-
- User
- Posts: 142
mobhar wrote:
Try this:
$(function() {
$(".ewTableRow, .ewTableAltRow").dblclick(function(){
window.open($(this).find(".ewRowLink.ewDetailView").attr('href'), '_self');
});
});
- Make sure you have already put it in "Startup Script" of "List
Page" that belongs to the master table, - Make sure you have already enabled "Master/Detail View (as Detail)"
option from "Table" setup -> "Table Options" -> "List
Page" that belongs to the detail table, - Make sure you have already regenerated ALL the script files,
- It should work, as I've just tried it here.
This actually works, my problem is that I had the "Master/Detail View (as Detail)" disable. Now the problem I have is that my when I try adding details on this screen, the auto-values are not loading. This is not a big deal if I can change the screen.
Now when I double-click on the master list record is taking me to the: AA_Riskview.php?showdetail=AA_RiskDetail&Risk_Id=14
Instead if after the double-click the link would take me to: AA_RiskDetaillist.php?showmaster=AA_Risk&fk_Risk_Id=14. My problem will be resolved. Becase on this screen everything works as expected.
Can this be done by modifying the script?
-
- User
- Posts: 11737
Make sure you have already enabled "Selected records" from "PHP" -> "Page Options (Global)" -> "Export", as this will add the checkbox at each row in the List Page (needed for run the following code at step #2 below),
Put the following code in "Startup Script" section that belongs to the List Page of your "AA_Risk" table:
$(document).ready(function() {
$('tr').dblclick(function(){
var row_id = $(this).attr('id');
var id = $("#" + row_id + " input[name='key_m[]']").val();
window.location = "AA_RiskDetaillist.php?showmaster=AA_Risk&fk_Risk_Id"+id;
});
});
- Regenerate ALL the script files again.