g_modal is closing on URL change in Workspace

Satanik1
Giga Guru

Hello Experts,

 

I have developed an UI page to open in a g_modal for workspace. Once I am clicking the button, its opening the popup correctly. Inside the popup, there are list of records which are actually hyperlinks. Once I click any one of them to open, the record opens up and getting closed immediately. Is there any solution for this ?

This is the below code for opening the popup:

 

	var url = '/sn_oper_res_test_output_list.do';
    g_modal.showFrame({
        url: url,
        title: 'Test Output',
        height: '600em',
        width: '600em',
    });

 

Thanks,

Satanik

3 REPLIES 3

Satishkumar B
Giga Sage
Giga Sage

Hi @Satanik1 

Using target="_blank" will prevent the modal from closing when a hyperlink inside it is clicked, as it opens the link in a new tab.

 

 

<a href="/your_record_url" target="_blank">Open Record</a>

 

 

……………………………………………………………………………………………………

Please Mark it helpful 👍and Accept Solution✔️!! If this helps you

Hi Satish,

 

Thanks for responding. I am not using target="_blank" in the link. here is the code below.

 

<j:while test="${grScenAnalysis.next()}">
					<tr>
						<td><a href="/sn_oper_res_test_output.do?sysparm_sys_id=${grScenAnalysis.sys_id}">${grScenAnalysis.number}</a></td>
						<td>${grScenAnalysis.name}</td>
						<td>${grScenAnalysis.assigned_to.getDisplayValue()}</td>
						<td>${grScenAnalysis.state.getDisplayValue()}</td>
</tr>
</j:while>

 

Thanks,

Satanik

Hi @Satanik1 

To prevent the modal from closing when clicking hyperlinks:

  1. Avoid Full Page Reloads: Ensure that clicking links doesn’t trigger a page reload.

  2. Use AJAX for Dynamic Content: Fetch and display content dynamically within the modal using AJAX instead of navigating directly.

……………………………………………………………………………………………………

Please Mark it helpful and Accept Solution!! If this helps you!!