phpmaker check master details page code example

Example 1: phpmaker check master details page

if ($this->MasterRecordExists) { ?>
    <style>#fkecamatanlistsrch_SearchPanel, #fkecamatanlistsrch_SearchGroup {
    display: none;
    }
    </style>
<?php }

Example 2: phpmaker check master details page

So here is the latest updated version that also handling for Preview row (using Preview extension; only for the registered users), and make sure to put it in "Startup Script" of "List Page" that belongs to "Master Table".

<?php if (Security()->canEdit()) { // don't forget this for security ?>
$(".table.ew-table tr").dblclick(function(e) { // double click to open Edit Page in Modal Dialog
// make sure to exclude the following condition
if (!$(e.target).hasClass('btn') && !$(e.target).hasClass('ew-preview-row-btn') && !$(e.target).hasClass('custom-control-label')) {
var edit_modal = $(this).find("a.ew-row-link.ew-edit").attr("onclick"); // get the modal dialog javascript syntax
var edit_url = edit_modal.substring(edit_modal.lastIndexOf(":'") + 2, edit_modal.lastIndexOf("'")); // get the url that belongs to each row
ew.modalDialogShow({lnk:this, url: edit_url, caption: '<?php echo Language()->phrase("Edit"); ?>', btn: 'SaveBtn'}); // display the Edit Page in modal dialog
}
});

$(document).on("preview", function(e, args) { // for preview row
args.$tabpane.find("tr").dblclick(function (e) { // double click
// make sure to exclude the following condition
if (!$(e.target).hasClass('btn') && !$(e.target).hasClass('ew-preview-row-btn') && !$(e.target).hasClass('custom-control-label')) {
var edit_modal = $(this).find("a.ew-row-link.ew-edit").attr("onclick"); // get the modal dialog javascript syntax
var edit_url = edit_modal.substring(edit_modal.lastIndexOf(":'") + 2, edit_modal.lastIndexOf("'")); // get the url that belongs to each row
ew.modalDialogShow({lnk:this, url: edit_url, caption: '<?php echo Language()->phrase("Edit"); ?>', btn: 'SaveBtn'}); // display the Edit Page in modal dialog
}
});
});
<?php } ?>

<?php if (Security()->canView()) { // don't forget this for security ?>
$(".table.ew-table tr").click(function(e) { // single click to open View Page in Modal Dialog
// make sure to exclude the following condition
if (!$(e.target).hasClass('btn') && !$(e.target).hasClass('ew-preview-row-btn') && !$(e.target).hasClass('custom-control-label')) {
var view_modal = $(this).find("a.ew-row-link.ew-view").attr("onclick"); // get the modal dialog javascript syntax
var view_url = view_modal.substring(view_modal.lastIndexOf(":'") + 2, view_modal.lastIndexOf("'")); // get the url that belongs to each row
ew.modalDialogShow({lnk:this, url: view_url, caption: '<?php echo Language()->phrase("View"); ?>', btn: null}); // display the View Page in modal dialog
}
});

$(document).on("preview", function(e, args) { // for preview row
args.$tabpane.find("tr").click(function (e) { // single click
// make sure to exclude the following condition
if (!$(e.target).hasClass('btn') && !$(e.target).hasClass('ew-preview-row-btn') && !$(e.target).hasClass('custom-control-label')) {
var view_modal = $(this).find("a.ew-row-link.ew-view").attr("onclick"); // get the modal dialog javascript syntax
var view_url = view_modal.substring(view_modal.lastIndexOf(":'") + 2, view_modal.lastIndexOf("'")); // get the url that belongs to each row
ew.modalDialogShow({lnk:this, url: view_url, caption: '<?php echo Language()->phrase("View"); ?>', btn: null}); // display the View Page in modal dialog
}
});
});
<?php } ?>

Tags:

Php Example