Read Only Variables in a Variable Editor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2016 05:05 AM
I've seen that many people have been asking how to set to read only all the variables within the variable editor of an incident or any other task.
The solution is to modify (or create) the Formatter that shows the variable editor, for instance "Incident Variable Editor".
This formatter is using an UI macro called "com_glideapp_questionset_default_question_editor". If we open it we see the following code:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:requires name="scripts/js_includes_catalog.js" includes="true"/>
<g:requires name="styles/${new CatalogCssSelector().getVariableCss()}" includes="true"/>
<g2:render_component componentName="com.glideapp.questionset.DefaultQuestionEditor" />
</j:jelly>
We only need to add the following line before the g2:render_component, to have our variable editor in read only mode:
<j2:set var="jvar_questionset_read_only" value="true" />
Here the result:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:requires name="scripts/js_includes_catalog.js" includes="true"/>
<g:requires name="styles/${new CatalogCssSelector().getVariableCss()}" includes="true"/>
<j2:set var="jvar_questionset_read_only" value="true" />
<g2:render_component componentName="com.glideapp.questionset.DefaultQuestionEditor" />
</j:jelly>
I hope this solution helps you!
Cheers,
Roberto
- 2,862 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2020 01:39 PM
Very nice.. thanks!
