- Home
- Forum
- Angular - EJ 2
- Preserve Filters
Preserve Filters
Is there any way we can save grid filters in browser's memory or may be in the database for individual users?
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
AG
Ajith Govarthan
Syncfusion Team
March 16, 2021 01:54 PM UTC
Hi Visha,
Thanks for contacting Syncfusion support.
Query: Is there any way we can save grid filters in browser's memory or may be in the database for individual users?
Based on your query we suspect that you want to save the Grid’s filtered state in your Grid application. By default in EJ2 Grid you can maintain the state of the Grid by enabling the enablePersistence property.
To achieve your requirement we suggest you use the getPersistData method of EJ2 Grid to get the persisted grid state and using the setProperties method of EJ2 Grid you can restore the Grid state. The persistence feature will store the Grid settings in the browser’s local storage. For your convenience we have attached the sample and documentation, please refer them for your reference.
Code Example:
|
App.component.ts
onSave() {
this.savedProperties = JSON.parse(this.grid.getPersistData()); // get the current grid state here.
console.log( this.savedProperties )
}
onRestore() {
var persist= this.savedProperties
this.grid.setProperties(persist); // set the properties to restore the state.
console.log(persist)
} |
Note: Using the getPeristData method you can get the persistData and store them in your database.
Please get back to us if you need further assistance.
Regards,
Ajith G.
Marked as answer
VS
Visha Shah
March 19, 2021 07:53 PM UTC
This is what I was looking For.
Thanks you.
TS
Thiyagu Subramani
Syncfusion Team
March 22, 2021 06:05 AM UTC
Hi Visha,
Thanks for your update.
We are happy to hear that the provided solution works at your end.
Please get back to us, if you need any further assistance.
Regards,
Thiyagu S
SIGN IN To post a reply.
- 3 Replies
- 3 Participants
- Marked answer
-
VS Visha Shah
- Mar 15, 2021 04:49 PM UTC
- Mar 22, 2021 06:05 AM UTC