We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Save grid configuration or state

Thread ID:

Created:

Updated:

Platform:

Replies:

141106 Nov 23,2018 05:03 PM UTC Dec 3,2018 04:31 PM UTC Angular - EJ 2 3
loading
Tags: Grid
Gleny Rodriguez
Asked On November 23, 2018 05:03 PM UTC

Hello, Basically and Trying to archive this using the JS2 with angular.

I would like to provide to my user the possibility to save several sets of grid configurations (column visibility, column size, groupings, filters, sorting etc)
So, basically the user can arrange the grid in a way he likes and then save this configuration.

For example

Configuration set A : Three grid columns visible
Configuration set B: Two grid columns visible
Configuration set C: All grid columns visible
Configuration set D: All grid columns visible with different column size
Configuration set E: All grid columns visible with  Filters, Sorts and Grouping

Could you help me with this requirement?

This is the same approach from thread Ref# 121200

Thanks.

Madhu Sudhanan P [Syncfusion]
Replied On November 28, 2018 09:38 AM UTC

Hi Gleny, 

Thanks for contacting Syncfusion support. 

Query: Save state 

You can get the grid state using the getPersistData method of the grid as follows. 


export class FilterComponent implements OnInit { 
  ... 
 
  @ViewChild('grid') 
  public grid: GridComponent; 
 
 ... 
 
  public onChange(e: ChangeEventArgs): void { 
      let data: string = this.grid.getPersistData(); //get persist data 
  } 
} 


Query: Apply state 

You can apply the state to the grid using the setProperties method as follows. 

export class FilterComponent implements OnInit { 
  ... 
 
  @ViewChild('grid') 
  public grid: GridComponent; 
 
 ... 
 
  public setState(): void { 
    let persistedData: Object; //Grid state saved in server. 
      ..... 
      this.grid.setProperties(persistedData); //get persist data 
      this.grid.refresh(); 
  } 
} 


Regards, 
Madhu Sudhanan P 


Gleny Rodriguez
Replied On December 3, 2018 04:12 PM UTC

Awesome!, It works great!

Thanks, Madhu.



Madhu Sudhanan P [Syncfusion]
Replied On December 3, 2018 04:31 PM UTC

Hi Gleny, 
We are glad that the requirement has been achieved. 
Regards, 
Madhu 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;