Need a special offer?Find out if your project fits.
+

Hidden Filters

Answered
Malik asked on October 26, 2020

I have a data set with set of Dimensions , how I can build a report with filters option but some of those filters I need to be hidden , its just a flag ("Y" , "N") and I don't want the user to change it , but other filters the user can see it and filter the data using them .
this flag is part of my fields , but its not of part my columns / rows / filters of my report . 
 
regards 

3 answers

Public
Vera Didenko Vera Didenko Flexmonster October 27, 2020

Hello, Malik,
 
Thank you for writing to us. 
 
UI filters for a specific field can be disabled by specifying filters: false in the mapping object.
For example: 

var pivot = new Flexmonster({
...
report: {
dataSource: {
type: "json",
data: getData(),
mapping: {
...
"Flag": {
type: "string",
filters: false
},
}
},
slice: [...]
}
..

Please see the following JSFiddle we have prepared for you: https://jsfiddle.net/flexmonster/ay52srpw/
In the example, the UI filters are hidden only for the "Flag" field.
 
 
Please let us know if this works fine for you.
Looking forward to your reply.
 
Kind regards, 
Vera

Public
Malik October 28, 2020

thank you for your response , 
but this is not my case , 
in my case I want to build 2 reports : 
1- Category , Color and Prices with conditional flag = 'N'
2- Category , Color and Prices with conditional flag = 'Y'
the filter option will be available for category & color but NOT available for "flag" .
the "flag"  is not part of my reports ( column , row ) but its part of my data set ( fields ) .
 
 

Public
Vera Didenko Vera Didenko Flexmonster October 28, 2020

Hello, Malik,
 
Thank you for your reply. 
 
For your case, we would suggest disabling the UI filter for the "Flag" field and placing the "Flag" field in the reportFilters section.
This way the "Flag" field won't be visible on the grid, but the results could be filtered by the "Flag" field programmatically.
 
Please see the following JSFiddle for illustration: https://jsfiddle.net/flexmonster/a0zjk9d4/
In the example, the setFilter() API call is used for filtering the result by the "Flag" field ("N" or "Y") during runtime.
The UI filters for the "Flag" field are hidden by specifying filters: false in the mapping object.
 
 
Please let us know if such an approach would work fine for your case.
Looking forward to your response.
 
Kind regards, 
Vera

Please login or Register to Submit Answer