Click row to open view page in modal dialog

My 2021 project allowed me to click anywhere on a row to view it’s view page in a modal dialog however this code no longer works in v2022.

<?php if (Security()->canView()) {  ?>
$(".table.ew-table tr").click(function(e) { 
if (!$(e.target).hasClass('btn') && !$(e.target).hasClass('ew-preview-row-btn') && !$(e.target).hasClass('custom-control-label') && !$(e.target).hasClass('btn-group') && !$(e.target).hasClass('btn') && !$(e.target).hasClass('btn-group') && !$(e.target).hasClass('ew-icon') && !$(e.target).hasClass('icon-edit') && !$(e.target).hasClass('icon-view') && !$(e.target).hasClass('ew-row-link') && !$(e.target).hasClass('btn-default') && !$(e.target).hasClass('ew-list-option-body') && !$(e.target).hasClass('custom-checkbox')) {
var view_modal = $(this).find("a.ew-row-link.ew-view").attr("onclick"); 
var view_url = view_modal.substring(view_modal.lastIndexOf(":'") + 2, view_modal.lastIndexOf("'")); 
ew.modalDialogShow({lnk:this, url: view_url, caption: '<?php echo Language()->phrase("View"); ?>', btn: null});
}
});
<?php } ?>

Can someone help me get this working in my 2022 project?

You may press F12 in your browser and check for JavaScript error.Also see https://discourse.hkvstore.com/t/call-ew-modaldialogshow-in-custom-file/4839/1

Please try How to Display ViewPage in Modal Dialog on Row Click (v2022)

This worked perfect, thank you!