view.ClearFilters
Overview¶
Clear filter conditions set in the "Server Script". This can be used to disable filters set in the WebUI in the server script.
Filter conditions already set when view.ClearFilters() is called will be deleted. The contents of any new "view.Filters" set in the server script after view.ClearFilters() is called will be valid.
Cautions¶
- Only the "When Processing View" condition can be used.
Syntax¶
Parameters¶
There are no parameters.
Return Value¶
There is no return value.
Usage Examples¶
In the example below, all filter operations from the screen are disabled, and then a condition is added to "view.Filters" to extract records that contain the string "Software" in the "Body Column".
JavaScript¶
view.ClearFilters(); // Disable all filter operations from the screen
view.Filters.Body = 'Software'; // Extract items that contain the string 'Software' in the Body.
Code Samples¶
1. Control the filter conditions for each user role
Controls the filter conditions as follows.
| Role | Permission |
|---|---|
| Privileged user | Can view all records |
| Manager | Can view the records of the department they belong to |
| General employee | Can view only the records they are in charge of |
For this control, prepare groups as follows and make users members of them.
| Role | Privileged user group | Manager group |
|---|---|---|
| Privileged user | Member | |
| Manager | Member | |
| General employee |
In this sample code, they are defined as Privileged user group: GroupId=5 and Manager group: GroupId=4.
Also, to determine whether a record belongs to the department in charge, set ClassA so that a department can be selected.
Then, the filters are controlled as follows.
- Manager: targets records where ClassA = the user's own department ID
- General employee: targets records where Owner = the user's own user ID
JavaScript¶
Supported Versions¶
- Pleasanter 1.3.13.0 or later