- Home
- Forum
- Angular - EJ 2
- Give specific properties for State Persistence
Give specific properties for State Persistence
Hi Team,
I need to store only resizing property for State Persistence instead of all the properties like sorting etc.Please help ASAP.
Regards,
Bhavya
SIGN IN To post a reply.
4 Replies
BH
Bhavya Harini
April 24, 2020 04:32 AM UTC
Hi Team,
Please help on it ASAP
RS
Rajapandiyan Settu
Syncfusion Team
April 24, 2020 11:29 AM UTC
Hi Bhavya
Greetings from syncfusion support.
Query : I need to store only resizing property for State Persistence instead of all the properties like sorting etc.
From your query we could see that you need persist the resizing property of grid. But unfortunately we don’t have the support for persisting resizing settings in EJ2 Grid.
Please get back to us if you need further assistance on this.
Regards,
Rajapandiyan S
BH
Bhavya Harini
April 24, 2020 12:26 PM UTC
HI,
Currently Resize and sorting is persisting, but how we can remove other persisting properties like rowselection etc
RS
Rajapandiyan Settu
Syncfusion Team
April 29, 2020 01:08 PM UTC
Hi Bhavya,
Thanks for your update.
Query : Currently Resize and sorting is persisting, but how we can remove other persisting properties like rowselection etc
From your query we could see that you don’t need some properties in the persisted data of Grid. To do that you need set the default value for those properties. Please refer the below code example and sample from more information.
|
App.component.html
<button ejs-button (click)="save($event)">save</button> // save the persisted data
<button ejs-button (click)="load($event)">load</button> // load the persisted data in the grid
<ejs-grid #grid [dataSource]='data' [allowSorting]='true' [allowGrouping]='true' [allowPaging]=true
(dataBound)="dataBound($event)" height='210px' [toolbar]='toolbarOptions'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' textAlign='right' width=120></e-column>
<e-column field='CustomerID' headerText='Customer ID' width=150></e-column>
<e-column field='Freight' width=150></e-column>
<e-column field='ShipName' headerText='Ship Name' width=150></e-column>
</e-columns>
</ejs-grid>
App.component.ts
export class AppComponent implements OnInit {
@ViewChild('grid', { static: true }) public grid: GridComponent;
public data: object[];
public editSettings: EditSettingsModel;
public toolbarOptions: ToolbarItems[];
public resetProperties: object;
public count = 0;
ngOnInit(): void {
this.data = hierarchyOrderdata;
this.toolbarOptions = ['Search'];
}
dataBound(args) {
}
save(args) {
// get the persisted data of the grid
var savedProperties = JSON.parse(
this.grid.getPersistData()
);
console.log(savedProperties);
// if you don’t need some persisted settings (like filtering, searching, grouping etc.,) then set the default value to those setting.
//default value of pagesettings
savedProperties.pageSettings = { currentPage: 1, pageCount: 8, pageSize: 12 };
//default value of sortSettings
savedProperties.sortSettings = { columns: [] };
//default value of filterSettings
savedProperties.filterSettings = {};
//default value of groupSettings
savedProperties.groupSettings = { columns: [], showDropArea: true, showToggleButton: false, disablePageWiseAggregates: false,
allowReordering: false, showUngroupButton: true, showGroupedColumn: false };
//default value of searchSettings
savedProperties.searchSettings = { key: "", fields: [], operator: "contains", ignoreCase: true, ignoreAccent: false };
//default value of Selection settings
savedProperties.selectedRowIndex = -1
console.log(savedProperties);
this.resetProperties = savedProperties;
}
load(args) {
if (this.resetProperties) {
// set the modified persisted properties to the grid
this.grid.setProperties(this.resetProperties);
}
}
}
|
Please get back to us if you need further assistance on this.
Regards,
Rajapandiyan S
SIGN IN To post a reply.
- 4 Replies
- 2 Participants
-
BH Bhavya Harini
- Apr 23, 2020 09:12 AM UTC
- Apr 29, 2020 01:08 PM UTC