Bootstrap Multiselect Pentaho Filter — Added Support to RequireJS

Fernando Maia da Mota
4 min readNov 5, 2018

--

Repository available at:
* https://github.com/fernandommota/bootstrap-multiselect-pentaho-filter

Overview

This plugin apply the All Member propertie of Mondrian Schema with Bootstrap Multiselect plugin creating a better user experience.

If the user select the all options available, the request value parameter will be send with the All Member propertie configured in setup script.

Setup

Compatibility

  • Versions with support to RequireJS starts from 0.4 (current master);
  • Versions without support to RequireJS ended to 0.3.

Inside repository (jackrabbit persistence)

  • Download the repository as a zip, and rename the folder:

From

bootstrap-multiselect-pentaho-filter-master

to

bootstrap-multiselect-pentaho-filter
  • Compress the folder bootstrap-multiselect-pentaho-filter in a zip file the folder and import to your instance, the following example is consider the path public/bootstrap-multiselect-pentaho-filter.
  • Inside your CDE dashboard insert the file js/bootstrap-multiselect-pentaho-filter.js path as a “Javascript External File” resource:
${solution:bootstrap-multiselect/js/bootstrap-multiselect-pentaho-filter.js}
  • It’s necessary maintain the property name as bootstrapMultiselectPentahoFilter, this will be load as a variable with the functions of plugin:
  • In case the path of files be different of default example, update the shim configuration at bootstrap-multiselect-pentaho-filter.js to new path:

Static files approach with AppBuilder/Sparkl (filesystem)

Very similar with approach above, in this case it’s necessary change the paths.

  • Consider a plugin made with AppBuilder named as dashboard and the folder bootstrap-multiselect-pentaho-filter at path pentaho-solutions/system/dashboard/static/custom/js/libs/bootstrap-multiselect-pentaho-filter
  • Inside your CDE dashboard insert the file js/bootstrap-multiselect-pentaho-filter.js path as a “Javascript External File” resource:
../../../../api/repos/dashboard/static/custom/js/libs/bootstrap-multiselect-pentaho-filter/js/bootstrap-multiselect-pentaho-filter.js
  • It’s necessary maintain the property name as bootstrapMultiselectPentahoFilter, this will be load as a variable with the functions of plugin:
  • Update the path files of shim configuration at bootstrap-multiselect-pentaho-filter.js:

Usage

  • Add the follow function in preExecution propertie of multiselect component in a Pentaho CDF/CDA/CDE dashboard:

Ps. The variable bootstrapMultiselectPentahoFilter now is used to call the internal functions of plugin.

function preExecution(){
var obj = this;
obj.postExecution = function f(){
bootstrapMultiselectPentahoFilter.postExecutionSelect.call(
this
// Change to all member propertie of dimension
, '[Dimension Name].[All Member Name]'
// Change the labels about dimension
, 'Find dimension'
, 'Select a member'
, 'All members'
, ' - members selected'
// end labels about dimension
)
}
obj.preChange = function (newChoice){
// Change to all member propertie of dimension
return bootstrapMultiselectPentahoFilter.preChangeSelect.call(this, '[Dimension Name].[All Member Name]', newChoice);
};
obj.postFetch = function postFetch(result){
// configure the option for set the default value of parameter
bootstrapMultiselectPentahoFilter.postFetchSelect.call(this, result, 'all');
};
}

Options

If the parameter of filter is empty is possible in preChange function to configure who options by default will be selected, the options are:

  • “all” — All options of multiselect will be selected.
  • “first” — The first option of multiselect will be selected.
  • “first-n” — The first n options of multiselect will be selected.
  • “last” — The last option of multiselect will be selected.
  • “last-n” — The last n options of multiselect will be selected.
//example for default select the last 4 options in multiselect element.
obj.postFetch = function postFetch(result){
postFetchSelect.call(this, result, 'last-4');
};

That’s it!

(Jabá ) Workshop Avançado de BI com Pentaho Community — Evento confirmado em Brasília

Ps. Only for Brazilian community

Olá pessoal,

Informo aos participantes da comunidade Pentaho que residem na cidade e regiões próximas a Brasília (03/12 e 04/12), que em breve estarei em sua cidade com o “Workshop Avançado de BI com Pentaho Community” by BovBI.

Maiores informações no link:
http://bovbi.com.br/workshop

--

--

Fernando Maia da Mota

BSc in Computer Information Systems and MSc in Applied Computer Science, works with Business Intelligence since 2008, has been a speaker and presented several w