Skip to content

Commit 7b418ae

Browse files
authored
Create json_formatter.xml
1 parent af88ba1 commit 7b418ae

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="jelly:html" xmlns:g2="glide.ui">
3+
4+
<g:evaluate var="jvar_field_name" expression="RP.getWindowProperties().get('fieldName')" />
5+
6+
<button type="button"
7+
onclick="openJsonViewer('${jvar_field_name}');"
8+
title="View and Format JSON"
9+
class="btn btn-default btn-sm">
10+
<span class="icon-code"></span> JSON Viewer
11+
</button>
12+
13+
<script>
14+
function openJsonViewer(fieldName) {
15+
var jsonValue = g_form.getValue(fieldName);
16+
var gm = new GlideModal('json_viewer_ui_page', false); // Replace 'json_viewer_ui_page' with your actual UI Page or Widget ID
17+
gm.setTitle('JSON Data Viewer & Formatter for Field: ' + fieldName);
18+
gm.setPreference('json_data', jsonValue);
19+
gm.setSize(900);
20+
gm.render();
21+
}
22+
</script>
23+
</j:jelly>

0 commit comments

Comments
 (0)