Get Free Trial

How to add a filter not editable by users

Lorenzo Paraboschi asked on May 14, 2020

If i have 4 final users: user A, B, C, ADMIN.
Admin can see the filter “USER” as it is, but user A, B and C can’t change the selection of this filter ,which is pre-filtered by his name..
how can i do that?
There’s another way to pre-filter a report when some user with higher privileges can se and filter user with lower privileges?

1 answer

Illia Yatsyshyn Illia Yatsyshyn Flexmonster May 15, 2020

Hello, Lorenzo,
Thank you for contacting us.
Different reports can be loaded depending on the role of the user. For example, for some users filtering can be disabled or adjusted in the desired way. The component can even be presented in the read-only mode for chosen users.
The majority of options dedicated to the mentioned adjustments are properties of the options object. You are welcome to learn more about it from our documentation.
Concerning your case, the described result can be achieved using the following approach:

  1. Predefine filtering for each type of user in the way only its type is chosen to be displayed. It can be done using the filter object. For example, only “A” users can be displayed in the following way:
    "slice": {
    "rows": [{
    "uniqueName": "Type",
    "filter": { "members": [ "type.[a]" ] }
    { "uniqueName": "Email" },
    { "uniqueName": "Name" },
    { "uniqueName": "Phone" }

    You are welcome to get detailed information about filtering in our documentation.

  2. Next, the filtering of the specific hierarchy (Type”) for non-admin users needs to be disabled. It can be done using the mapping object and the filters property. Please see the following code snippet. It demonstrates disabling filtering by the “Type” hierarchy:
    mapping: {
    Type: { filters: false },
    Email: {},
    Name: {},
    Phone: {}

    Please note that each hierarchy from the data set needs to be mentioned in the mapping object. Otherwise, it will be ignored by the component. More about the mapping object itself can be found in our documentation.

We have prepared an example demonstrating the described approach.
However, in case the described approach is used, the user can still access the data about other users through filters of other hierarchies. In case such an access needs to be restricted as well, it is possible to use one of the following approaches:

  • Disable the filtering for all hierarchies from the data set using the showFilter property of the grid and chart objects (properties of the options object).
  • Preprocess the data set itself so that it contains only information about users that can be accessed.

Please let us know if it works for your case.
Do not hesitate to contact us in case additional questions appear.
Best regards,

Please login or Register to Submit Answer