Search Bar using Blox
I am curious if there is a way to create a search bar in blox that then filters the dashboard widgets to what is entered in the search bar.
-
Sure, please use this sample template and see the structured.
We used the JQAL query in BloX filter actions and connected it to dashboard filters using the Panel filters action ( in this case we used BRAND from the sample e-commerce cube)
you can also use the Filter Name to apply on dashboard filters instead or the Panel filters.
-
Hi Connor,
Which version of BloX are you using?
This message usually appears when using the old version, meaning all the new functions and actions ( filter is one of them) will not be supported.
Please make sure to download the latest from here and re-check.
Thanks,
Ron
-
Hi Ron,
I am also looking for same kind of functionality. However, tried the code which you have mentioned but not sure what we need to write in actions. What value should we pass in "contains"?
"actions": [ { "type": "Filters", "title": "Search", "data": { "filters": [ { "panelName": "Brand", "jaql": { "contains": "" } } ] } } ] }
I am looking for functionality like whatever we enter in search box that should act as a filter when we click on search button. I am using Sisense Blox version 2.
Could you please provide some solution? If you have any other or newer code for this, could you please share the same?
-
Hi Gaurav,
The contains property will automatically be populated with the text input's value.
When an input element is assigned an id, its value is automatically injected into the action's data property under the path dictated by the id.
In the attached template's example, the input's id directs the value into the contains attribute, thus completing the JAQL's search term
{ "type": "Input.Text", "width": "60%", "horizontalAlignment": "center", "id": "filters[0].jaql.contains", "placeholder": "placeholder", "defaultValue": "", "borderRadius": "4px", "borderStyle": "none", "backgroundColor": "#F4F4F8" }
Let me know if it makes sense.
Thanks,
Adi
-
Hi Adi,
Thank you for your response.
However, in my case this not working as you mentioned. When we enter any value in search box and click on search button then filter values shows "filtered with custom filter" message and inside the filter value is blank.
Please find below screenshot for reference.
I have used the exact same code which is there in the link. https://s3.amazonaws.com/sisenseblox/Community+Materials/BloX+Templates/Search+Bar.json
Please let me know if I missed out something.
Thanks!
-
Hi Grurav,
I checked again and it seems that we sent a version with an old syntax.
Can you try updating both jaql attributes to filterJaql?
In the input's id:
"id": "data.filters[0].filterJaql.contains",
and in the action structure:{
"type": "Filters",
"title": "Search",
"data": {
"filters": [
{
"panelName": "Brand",
"filterJaql": {
"contains": ""
}
}
]
}
} -
Hi All,
The full fixed template is available here.
-
Hi All,
Is there anyone who knows or maybe already created the search bar for multiple rows. I managed to create two search fields in the filter bar, however on of them remains empty when executing the search.
Furthermore, I was looking into an autocomplete functionality for the search bar. Is this possible, considering JSON being the only supported format? Any ideas?
Thanks in advance!
Please sign in to leave a comment.
Comments
12 comments