Blox - Multi-Select Dropdown List Filter
Blox - Multi-Select Dropdown List Filter
- For Sisense on Windows add the below string in order to create the column:
'<li><input type="checkbox" />'+[Category].[Category]+'</li>'- For Sisense on Linux:
'<li><input type=checkbox>'+[Category].[Category] + '</li>'var outputFilters = [];
var widgetid = payload.widget.oid;
var widgetElement = $('[widgetid="' + widgetid + '"]');
widgetElement.find($('blox input:checked')).parent().each(function () {
var values = $('.fillmeup').attr('value') + $(this).text();
$('.fillmeup').attr('value', values);
}).each((i, lmnt) => {
outputFilters.push($(lmnt).text());
})
payload.widget.dashboard.filters.update(
{
'jaql': {
'dim': payload.data.dim,
'title': payload.data.title,
'filter': {
'members': outputFilters
},
'datatype': 'text'
}
},
{
'save': true,
'refresh': true
}
){
"type": "MultiBoxSelection",
"title": "Apply",
"data": {
"dim": "FilterDimension",
"title": "FilterTitle"
}
}5. Add the widget's script.
For each widget you need to change identifiers [CategoryList] and [CategoryItems] - these identifiers should be unique per each widget on a page:
widget.on('ready', function() {
var checkList = document.getElementById('CategoryList');
var items = document.getElementById('CategoryItems');
checkList.getElementsByClassName('anchor')[0].onclick = function(evt) {
if (items.classList.contains('visible')) {
items.classList.remove('visible');
items.style.display = "none";
} else {
items.classList.add('visible');
items.style.display = "block";
}
}
items.onblur = function(evt) {
items.classList.remove('visible');
}
});
widget.on('processresult', function(a, b) {
b.result.slice(1, b.result.length).forEach(function(i) {
b.result[0][0].Text = b.result[0][0].Text + ' ' + i[0].Text
})
});{
"type": "TextBlock",
"spacing": "large",
"id": "",
"class": "",
"text": "<div id='CategoryList' class='dropdown-check-list' tabindex='100'> <span class='anchor'>Select Category</span> <ul id='CategoryItems' class='items'>{panel:CategoryHTML}</ul> </div>"
}- Make sure you have the Category in the items (The new column was created) and name the Item "Category".
- Make sure you have a Category Filter (The actual category field and name it "Category") on the dashboard level.
- Make sure to replace the field and table names with the relevant field/table in the Action, in the editor of the Blox widget in the Blox items and in the dashboard filter.
Disclaimer: Please note that this blog post contains one possible custom workaround solution for users with similar use cases. We cannot guarantee that the custom code solution described in this post will work in every scenario or with every Sisense software version. As such, we strongly advise users to test solutions in their environment prior to deploying them to ensure that the solutions proffered function as desired in their environment. For the avoidance of doubt, the content of this blog post is provided to you "as-is" and without warranty of any kind, express, implied, or otherwise, including without limitation any warranty of security and or fitness for a particular purpose. The workaround solution described in this post incorporates custom coding, which is outside the Sisense product development environment and is, therefore, not covered by Sisense warranty and support services.
Rafael Ferreira
·1 year agoHi Everyone,
Whoever is trying to attempt this BloX Multi-select option, do not import that data provided by Liliia_DevX, we have determined that the metadata carries over, so you must create the dashboard from scratch.
The BloX editor script:
Then you can add the Action button to your env., the dashboard script, and then it should work.
Liliia Kislitsyna
AdminOP1 year agoAstroraf hi,
Thanks for sharing your feedback. I recommend you to raise a Support ticket with the following details:
1. Sisense version and platform.
2. Exported ElastiCube with the data and dashboard as a dash file.
3. HAR file with the content recorded replicating the issue.
We'll be happy to review the issue together to understand why the error is occurring.
Thanks, Lily
Rafael Ferreira
·1 year agoLiliia_DevX
Thank you for providing this template. I have tried to recreate this on my side but I am getting an error on the BloX side. I have duplicated the model and added the custom columns along with all the steps provided but still getting an error. Below is the error I am getting. Do you have a solution to this?