In code or by adding the field list popup button to the toolbar its possible to present the pivot table field list popup. However this popup includes fields for all dimensions in the pivot table.
Is it possible to cause just the member select list for a single dimension to be shown? This is the popup shown when the filter icon of a dimension button is clicked? The code which presents this popup is in the event-base module.
If so, how can this popup be instantiated and shown?
There are two uses cases. One is to have several dimensions on the pivot table but only allow the user to change the member selection of one dimension.
Another use case is where, again, there are several dimensions used and the member selections only one is permitted but the pivot table is not shown because only the data is needed which will be processed by other code.
In the first use case its possible a button, if a button can be used, could be attached to the pivot table in some way (the toolbar for example). In the second case the button will need to be free-standing.
Thanks
Hi Bill Sedon,
Please find the response below:
Query |
Comments |
|
If so, how can this popup be instantiated and shown? There are two uses cases. One is to have several dimensions on the pivot table but only allow the user to change the member selection of one dimension. |
To use the filter dialog for a specific dimension, use the showFilterIcon property on the rows, columns, and filters options in the bound report to hide the filter icon for fields other than this field. To disable the filter icon for fields (i.e., dimensions) that are not bound in the report, use the fieldMapping option's showFilterIcon property. Please see the code example below.
Code example:
Output screenshot:
|
|
Another use case is where, again, there are several dimensions used and the member selections only one is permitted but the pivot table is not shown because only the data is needed which will be processed by other code. |
You can slice the data using filter and filterSettings, which will be considered during aggregation but will not be displayed in the pivot table. Please refer the below code example.
Code example:
|
Please let us know if you have any concerns.
Regards,
Angelin Faith Sheeba.
Sorry, your reply does not answer the question. Your answer only describes how to add to make the filter icon appear on a dimension button. This is very well documented and there are examples available on the Syncfusion site.
As stated in the question, I want to be able to display the popup from a button on the *toolbar* and also be able to display the popup using an *external* button.
Thanks.
Hi Bill,
We've prepared a sample that uses an external button and a custom button option in the toolbar UI to display the member filter pop-up for the “country” field. Please refer the below code example.
Code Example:
//For external filter button. document.getElementById('btn').onclick = function () { // Get the external filter button element here. var mouseEventArgs = { target: document.getElementById('btn'), }; pivotGridObj.pivotButtonModule.updateFiltering(mouseEventArgs); };
//For toolbar filter button toolbarRender: function (args) { // Create a custom toolbar items here args.customToolbar.splice(10, 0, { text: 'Country filter', tooltipText: 'Country filter', click: this.toolbarClicked.bind(this), }); }, toolbarClicked: function (args) { // Get the toolbar filter button element here. let mouseEventArgs = { target: document.getElementsByClassName('e-tbar-btn')[6], }; pivotGridObj.pivotButtonModule.updateFiltering(mouseEventArgs); }, dataBound: function (args) { // Need to set the id for the parent element of toolbar filter button let filter = document.querySelectorAll('.e-toolbar-item')[10]; if (filter) { filter.setAttribute('id', 'Country'); } }, |
Sample: https://stackblitz.com/edit/x9dd5j-6tse2h?file=index.js,index.html
Output screenshot:
Please let us know if you have any concerns.
Regards,
Angelin Faith Sheeba
Thank you very much. This is fantastic.
Thanks for the update. Please contact us if you have any other queries. We are always happy to assist you.
The answer you provided is great. Now it will be great to know if it is possible to present the dimensions selector independently. The dimensions selector is part of the field list dialog but is it possible to present a window for selecting one or more dimensions outside the field list?
Hi Bill,
Please use the code example below to get the fieldlist information in which you can get the OLAP cube's measures and dimensions details and customize based on your needs.
Code example:
enginePopulated: function (args) { console.log(pivotObj.olapEngineModule.fieldList); } |
However, we have prepared a sample to add a dimension in rows using button click. Please refer the below sample.
Sample: https://stackblitz.com/edit/nsgo8m-t44tw5?file=index.html,index.js
Regards,
Angelin Faith Sheeba
Thank you.
Thanks for the update. Please contact us if you have any other queries. We are always happy to assist you.