how to have multi select choice in jelly script interactive filter

Bindhu1
Tera Contributor

How to modify below jelly script to have multi selection value ?
refer the image, now i am able to select only one value .Need to change that to multi selection value.

Bindhu1_0-1681139189105.png

..............................

Code is written in dynamic content block interactive filter.

<?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:evaluate var="jvar_tasktypes" object="true" jelly="true">
var obj=[];
var gr= new GlideRecord('u_one_team_workflow_location');
gr.addEncodedQuery('u_active=true');
gr.orderBy('u_name');
gr.query();
while(gr.next()){
obj.push([gr.getValue('u_name')]);
}
obj;
</g:evaluate>

<select id='filter_task_type' class='select2-search' onchange='filterTaskType()'>
<option value="">All</option>
<j:forEach var="jvar_tasktype" items="${jvar_tasktypes}">
<option value="${jvar_tasktype[0]}">${jvar_tasktype[0]}</option>
</j:forEach>
</select>

<script>
var dbh = new DashboardMessageHandler("filter_tasktype");
function filterTaskType(){
var status = $j('#filter_task_type').val();
if (status)
dbh.publishFilter('u_request_item_location_mapping_talent_related_request', 'location_u_name=' + status); <!-- change the cat_item sys_id and variable.sys_id with actual sys id of catalog item and target variable. -->
else
dbh.removeFilter();
}
filterTaskType();
</script>
</j:jelly>

Bindhu1_1-1681139399070.png

 

Thanks, 

 



3 REPLIES 3

Gary Fawcett1
Tera Guru

Wow I have the exact same requirement, if I work it out.  I will reply to your message.

Gary Fawcett1
Tera Guru

That is a html features, so all you need to do is add 'multiple='true' to the select line

As in :

<select id='jvar_name' class='select2-search' onchange='filterTaskType()' multiple='true'>
<option value="">All</option>
<j:forEach var="jvar_app" items="${jvar_app_name}"> 
<option value="${jvar_app[1]}">${jvar_app[1]}</option>        
</j:forEach>
</select>

It worked fine for me.  Hope that helps you.

Gary

Do you have a screenshot of how the multiple select UI looked once you got it working?