Manoj Chaurasia Posted July 24, 2013 Share Posted July 24, 2013 Hello I'm currently trying to get list of all values for the filter schema not just those unselected / selected. Using spotfire.webPlayer.includedFilterSettings.ALL_WITH_UNCHECKED_HIERARCHY_NODES or spotfire.webPlayer.includedFilterSettings.ALL_WITH_CHECKED_HIERARCHY_NODES option does not change the results for checked or unchecked. Always get only checked values. Kind regards, Kuldeep Singh Link to comment Share on other sites More sharing options...
Tyger Guzman 2 Posted December 20, 2019 Share Posted December 20, 2019 You can obtain thedistinct values from the data table/column for the filters. function BuildUniqueList(doc, dtname, dcname, elem_name) { doc.data.getDataTable(dtname, function(dataTable) { dataTable.getDataColumn(dcname, function(dataColumn) { dataColumn.getDataColumnProperties(function(properties) {}); dataColumn.getDistinctValues(0, 100, function(distinctValues) { console.log(distinctValues); t = distinctValues var data = []; for (var i = 0; i < distinctValues.values.length; i++) { //console.log(i) data.push({ label: distinctValues.values, value: distinctValues.values, selected: true }) } console.log(data) $(elem_name).multiselect('dataprovider', data); $(elem_name).multiselect('refresh'); }); }); }); }In the above example I take the distinct values from a column and then pass them to a multiselect drop down. Usinghttp://davidstutz.de/bootstrap-multiselect/ Then the changes from the drop down are returned to the setfilters function : $(document).ready(function () { $('#MyDropdown').multiselect({ includeSelectAllOption: true, onChange: function () { console.log("DropDownChanged") var ViewDD = document.getElementById("MyDropdown"); var selectedView = []; for (var i = 0; i < ViewDD.length; i++) { if (ViewDD.options.selected) selectedView.push(ViewDD.options.value); } console.log(selectedView) SetFilterValues(doc, 'Filtering scheme', 'Table', 'Column', selectedView) }, onSelectAll: function () { console.log("DropDownChanged") var ViewDD = document.getElementById("MyDropdown"); var selectedView = []; for (var i = 0; i < ViewDD.length; i++) { selectedView.push(ViewDD.options.value); } console.log(selectedView) SetFilterValues(doc, 'Filtering scheme', 'Table', 'Column', selectedView) }, buttonText: function (options, select) { return "DropDown Name"; } }); }); function SetFilterValues(doc, fil_sch, dtname, dcname, mysel) { var filterColumns = new Array(); filterColumns[0] = { filteringSchemeName: fil_sch, dataTableName: dtname, dataColumnName: dcname, filterSettings: { includeEmpty: true, values: mysel } } doc.filtering.setFilters(filterColumns, 2); }; Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now