- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 11:09 AM
Hi all,
I'm using a Tokyo version and I'm trying to create an interactive filter for a string field, I found on community a code but it didnt work, following below:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<script>
var my_dashboardMessageHandler = new DashboardMessageHandler("my_unique_id");
function searchForStrings (str) {
var filter_message = {};
filter_message.id = "my_unique_id";
filter_message.table = "task";
filter_message.filter = "short_descriptionLIKE" + str;
SNC.canvas.interactiveFilters.setDefaultValue({
id: filter_message.id,
filters: [filter_message]
},false);
my_dashboardMessageHandler.publishFilterMessage(filter_message.table,filter_message.filter);
}
</script>
Short description <br/>
<input id="myCustomsearchForStrings" type="text" value="" onChange="searchForStrings(this.value);" />
</j:jelly>
Is there something I can do?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 11:47 AM
The code is the same as what you had, I have it for the task table, and short description, if you need to search on any other fields you need to update the "ShortDescription" value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 11:36 AM
Yes you need to create Dynamic Content with the code and then you can use it in a dashboard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 11:41 AM
Hey Tsura,
Could you please, send me your code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 11:45 AM
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<script>
var my_dashboardMessageHandler = new DashboardMessageHandler("my_unique_id");
function publishFilter () {
var filter_message = {};
filter_message.id = "my_unique_id";
filter_message.table = "task";
var value = gel('cfShortDescription').value;
filter_message.filter = "short_descriptionLIKE" + value;
SNC.canvas.interactiveFilters.setDefaultValue({
id: filter_message.id,
filters: [filter_message]
}, false);
my_dashboardMessageHandler.publishFilter(filter_message.table, filter_message.filter);
}
function clearFilter() {
var filter_message = {};
filter_message.id = "my_unique_id";
filter_message.table = "task";
filter_message.filter = "";
gel('cfShortDescription').value = '';
SNC.canvas.interactiveFilters.setDefaultValue({
id: filter_message.id,
filters: [filter_message]
}, false);
my_dashboardMessageHandler.removeFilter();
}
</script>
Short Description:
<input id="cfShortDescription" type="input" value="" /><br/>
<input id="removeCustomFilter" type="button" value="Clear" onclick="clearFilter();" />
<input id="addCustomFilter" type="button" value="Search" onclick="publishFilter();" />
</j:jelly>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 11:47 AM
The code is the same as what you had, I have it for the task table, and short description, if you need to search on any other fields you need to update the "ShortDescription" value