Skip to content

Commit

Permalink
Edited documentation for PivotGird topics (#1399)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarielaTihova authored Nov 19, 2024
1 parent 0a7b64b commit b508f71
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 32 deletions.
44 changes: 29 additions & 15 deletions doc/en/components/grids/_shared/state-persistence.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The {ProductName} State Persistence in {Platform} {ComponentTitle} allows develo
<!-- end: React, WebComponents -->

<!-- Blazor -->
The {ProductName} State Persistence in {Platform} {ComponentTitle} allows developers to easily save and restore the grid state. When the `GridState` is applied on the {Platform} `{ComponentName}`, it exposes the `GetStateAsString` and `ApplyStateFromString` methods that developers can use to achieve state persistence in any scenario.
The {ProductName} State Persistence in {Platform} {ComponentTitle} allows developers to easily save and restore the grid state. When the `GridState` is applied on the {Platform} `{ComponentName}`, it exposes the `GetStateAsStringAsync` and `ApplyStateFromStringAsync` methods that developers can use to achieve state persistence in any scenario.
<!-- end: Blazor -->

## Supported Features
Expand Down Expand Up @@ -114,11 +114,17 @@ The developer may choose to get only the state for a certain feature/features, b
The `GetState` method returns the grid state in a `GridStateInfo` object, containing all the state info. Additional steps may be required in order to save it.
<!-- end: React, WebComponents -->

<!-- Blazor, React, WebComponents -->
<!-- React, WebComponents -->
The `GetStateAsString` returns a serialized JSON string, so developers can just take it and save it on any data storage (database, cloud, browser localStorage, etc).

The developer may choose to get only the state for a certain feature/features, by passing in an array with feature names as an argument. Empty array will result to using the default state options.
<!-- end: Blazor, React, WebComponents -->
<!-- end: React, WebComponents -->

<!-- Blazor -->
The `GetStateAsStringAsync` returns a serialized JSON string, so developers can just take it and save it on any data storage (database, cloud, browser localStorage, etc).

The developer may choose to get only the state for a certain feature/features, by passing in an array with feature names as an argument. Empty array will result to using the default state options.
<!-- end: Blazor -->

<!-- Angular -->
```typescript
Expand Down Expand Up @@ -184,10 +190,10 @@ const sortingFilteringStates: IgrGridStateInfo = gridState.getState(['sorting',
@code {
// get all features` state in a serialized JSON string
string stateString = gridState.GetStateAsString(new string[0]);
string stateString = gridState.GetStateAsStringAsync(new string[0]);
// get the sorting and filtering expressions
string sortingFilteringStates = gridState.GetStateAsString(new string[] { "sorting", "filtering" });
string sortingFilteringStates = gridState.GetStateAsStringAsync(new string[] { "sorting", "filtering" });
}
```

Expand All @@ -199,9 +205,13 @@ const sortingFilteringStates: IgrGridStateInfo = gridState.getState(['sorting',
`ApplyState` - The method accepts a `GridStateInfo` object as argument and will restore the state of each feature found in the object or specified features as second argument.
<!-- end: React, WebComponents -->

<!-- Blazor, React, WebComponents -->
<!-- React, WebComponents -->
`ApplyStateFromString` - The method accepts a serialized JSON string as argument and will restore the state of each feature found in the JSON string or specified features as second argument.
<!-- end: Blazor, React, WebComponents -->
<!-- end: React, WebComponents -->

<!-- Blazor -->
`ApplyStateFromStringAsync` - The method accepts a serialized JSON string as argument and will restore the state of each feature found in the JSON string or specified features as second argument.
<!-- end: Blazor -->

<!-- Angular -->
```typescript
Expand All @@ -225,8 +235,8 @@ gridState.applyState(sortingFilteringStates, [])
```

```razor
gridState.ApplyStateFromString(gridStateString, new string[0]);
gridState.ApplyStateFromString(sortingFilteringStates, new string[0])
gridState.ApplyStateFromStringAsync(gridStateString, new string[0]);
gridState.ApplyStateFromStringAsync(sortingFilteringStates, new string[0])
```

<!-- Angular -->
Expand All @@ -238,7 +248,7 @@ The `Options` object implements the `GridStateOptions` interface, i.e. for every
<!-- end: React, WebComponents -->

<!-- Blazor -->
The `Options` object implements the `GridStateOptions` interface, i.e. for every key, which is the name of a certain feature, there is the boolean value indicating if this feature state will be tracked. `GetStateAsString` methods will not put the state of these features in the returned value and `ApplyStateFromString` methods will not restore state for them.
The `Options` object implements the `GridStateOptions` interface, i.e. for every key, which is the name of a certain feature, there is the boolean value indicating if this feature state will be tracked. `GetStateAsStringAsync` methods will not put the state of these features in the returned value and `ApplyStateFromStringAsync` methods will not restore state for them.
<!-- end: Blazor -->

<!-- Angular -->
Expand Down Expand Up @@ -421,14 +431,14 @@ function restoreGridState() {
}
async void SaveGridState() {
string state = gridState.getStateAsString(new string[0]);
string state = gridState.GetStateAsStringAsync(new string[0]);
await JS.InvokeVoidAsync("window.localStorage.setItem", "grid-state", state);
}
async void RestoreGridState() {
string state = await JS.InvokeAsync<string>("window.localStorage.getItem", "grid-state");
if (state) {
gridState.ApplyStateFromString(state, new string[0]);
gridState.ApplyStateFromStringAsync(state, new string[0]);
}
}
}
Expand Down Expand Up @@ -953,7 +963,7 @@ this.state.applyState(state, ['filtering', 'rowIslands']);
<!-- Blazor -->
Then the `GetState` API will return the state for all grids (root grid and child grids) features excluding `Selection` and `Sorting`. If later on the developer wants to restore only the `Filtering` state for all grids, use:
```razor
gridState.ApplyStateFromString(gridStateString, new string[] { "filtering", "rowIslands" });
gridState.ApplyStateFromStringAsync(gridStateString, new string[] { "filtering", "rowIslands" });
```
<!-- end: Blazor -->
<!-- ComponentEnd: HierarchicalGrid -->
Expand Down Expand Up @@ -1101,9 +1111,13 @@ state.applyState(gridState.columnSelection);
* `GetState` method uses JSON.stringify() method to convert the original objects to a JSON string. JSON.stringify() does not support Functions, thats why the `GridState` directive will ignore the columns `Formatter`, `Filters`, `Summaries`, `SortStrategy`, `CellClasses`, `CellStyles`, `HeaderTemplate` and `BodyTemplate` properties.
<!-- end: Angular -->

<!-- Blazor, React, WebComponents -->
<!-- React, WebComponents -->
* `GetStateAsString` method uses JSON.stringify() method to convert the original objects to a JSON string. JSON.stringify() does not support Functions, thats why the `GridState` component will ignore the columns `Formatter`, `Filters`, `Summaries`, `SortStrategy`, `CellClasses`, `CellStyles`, `HeaderTemplate` and `BodyTemplate` properties.
<!-- end: Blazor, React, WebComponents -->
<!-- end: React, WebComponents -->

<!-- Blazor -->
* `GetStateAsString` method uses JSON.stringify() method to convert the original objects to a JSON string. JSON.stringify() does not support Functions, thats why the `GridState` component will ignore the columns `Formatter`, `Filters`, `Summaries`, `SortStrategy`, `CellClasses`, `CellStyles`, `HeaderTemplate` and `BodyTemplate` properties.
<!-- end: Blazor -->

<!-- ComponentEnd: Grid, HierarchicalGrid, TreeGrid -->

Expand Down
4 changes: 2 additions & 2 deletions doc/en/components/grids/pivot-grid/remote-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public pivotConfigHierarchy: IPivotConfiguration = {
<!-- WebComponents -->
```typescript
public pivotConfigHierarchy: IgcPivotConfiguration = {
columnStrategy: NoopPivotDimensionsStrategy.instance(),
rowStrategy: NoopPivotDimensionsStrategy.instance(),
columnStrategy: IgcNoopPivotDimensionsStrategy.instance(),
rowStrategy: IgcNoopPivotDimensionsStrategy.instance(),
}
```
<!-- end: WebComponents -->
Expand Down
44 changes: 29 additions & 15 deletions doc/jp/components/grids/_shared/state-persistence.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ _language: ja
<!-- end: React, WebComponents -->

<!-- Blazor -->
{Platform} {ComponentTitle} の {ProductName} 状態保持を使用すると、開発者はグリッドの状態を簡単に保存および復元できます。`GridState` が {Platform} `{ComponentName}` に適用されると、`GetStateAsString` および `ApplyStateFromString` メソッドが公開され、開発者はこれを使用して、あらゆるシナリオで状態の永続化を実現できます。
{Platform} {ComponentTitle} の {ProductName} 状態保持を使用すると、開発者はグリッドの状態を簡単に保存および復元できます。`GridState` が {Platform} `{ComponentName}` に適用されると、`GetStateAsStringAsync` および `ApplyStateFromStringAsync` メソッドが公開され、開発者はこれを使用して、あらゆるシナリオで状態の永続化を実現できます。
<!-- end: Blazor -->

## サポートされる機能
Expand Down Expand Up @@ -115,11 +115,17 @@ _language: ja
`GetState` メソッドは、すべての状態情報を含むグリッドの状態を `GridStateInfo` オブジェクトで返します。保存するには追加の手順が必要になる場合があります。
<!-- end: React, WebComponents -->

<!-- Blazor, React, WebComponents -->
<!-- React, WebComponents -->
`GetStateAsString` は、シリアル化された JSON 文字列を返します。これは、開発者がそれを取得して任意のデータストレージ (データベース、クラウド、ブラウザーの localStorage など) に保存できます。

開発者は、引数として機能名を含む配列を渡すことにより、特定の機能の状態のみを取得することを選択できます。空の配列では、デフォルトの状態オプションが使用されます。
<!-- end: Blazor, React, WebComponents -->
<!-- end: React, WebComponents -->

<!-- Blazor -->
`GetStateAsStringAsync` は、シリアル化された JSON 文字列を返します。これは、開発者がそれを取得して任意のデータストレージ (データベース、クラウド、ブラウザーの localStorage など) に保存できます。

開発者は、引数として機能名を含む配列を渡すことにより、特定の機能の状態のみを取得することを選択できます。空の配列では、デフォルトの状態オプションが使用されます。
<!-- end: Blazor -->

<!-- Angular -->
```typescript
Expand Down Expand Up @@ -185,10 +191,10 @@ const sortingFilteringStates: IgrGridStateInfo = gridState.getState(['sorting',
@code {
// get all features` state in a serialized JSON string
string stateString = gridState.GetStateAsString(new string[0]);
string stateString = gridState.GetStateAsStringAsync(new string[0]);
// get the sorting and filtering expressions
string sortingFilteringStates = gridState.GetStateAsString(new string[] { "sorting", "filtering" });
string sortingFilteringStates = gridState.GetStateAsStringAsync(new string[] { "sorting", "filtering" });
}
```

Expand All @@ -200,9 +206,13 @@ const sortingFilteringStates: IgrGridStateInfo = gridState.getState(['sorting',
`ApplyState` - このメソッドは引数として `GridStateInfo` オブジェクトを受け取り、オブジェクト内で見つかった各フィーチャまたは 2 番目の引数として指定されたフィーチャの状態を復元します。
<!-- end: React, WebComponents -->

<!-- Blazor, React, WebComponents -->
<!-- React, WebComponents -->
`ApplyStateFromString` - このメソッドはシリアル化された JSON 文字列を引数として受け取り、JSON 文字列内で見つかった各機能の状態、または 2 番目の引数として指定された機能を復元します。
<!-- end: Blazor, React, WebComponents -->
<!-- end: React, WebComponents -->

<!-- Blazor -->
`ApplyStateFromStringAsync` - このメソッドはシリアル化された JSON 文字列を引数として受け取り、JSON 文字列内で見つかった各機能の状態、または 2 番目の引数として指定された機能を復元します。
<!-- end: Blazor -->

<!-- Angular -->
```typescript
Expand All @@ -226,8 +236,8 @@ gridState.applyState(sortingFilteringStates, [])
```

```razor
gridState.ApplyStateFromString(gridStateString, new string[0]);
gridState.ApplyStateFromString(sortingFilteringStates, new string[0])
gridState.ApplyStateFromStringAsync(gridStateString, new string[0]);
gridState.ApplyStateFromStringAsync(sortingFilteringStates, new string[0])
```

<!-- Angular -->
Expand All @@ -239,7 +249,7 @@ gridState.ApplyStateFromString(sortingFilteringStates, new string[0])
<!-- end: React, WebComponents -->

<!-- Blazor -->
`Options` オブジェクトは、`GridStateOptions` インターフェースを実装します。特定の機能の名前であるキーには、この機能の状態を追跡するかどうかを示すブール値があります。`GetStateAsString` メソッドはこれらの機能の状態を戻り値に入れず、`ApplyStateFromString` メソッドはその状態を復元しません。
`Options` オブジェクトは、`GridStateOptions` インターフェースを実装します。特定の機能の名前であるキーには、この機能の状態を追跡するかどうかを示すブール値があります。`GetStateAsStringAsync` メソッドはこれらの機能の状態を戻り値に入れず、`ApplyStateFromStringAsync` メソッドはその状態を復元しません。
<!-- end: Blazor -->

<!-- Angular -->
Expand Down Expand Up @@ -422,14 +432,14 @@ function restoreGridState() {
}
async void SaveGridState() {
string state = gridState.getStateAsString(new string[0]);
string state = gridState.GetStateAsStringAsync(new string[0]);
await JS.InvokeVoidAsync("window.localStorage.setItem", "grid-state", state);
}
async void RestoreGridState() {
string state = await JS.InvokeAsync<string>("window.localStorage.getItem", "grid-state");
if (state) {
gridState.ApplyStateFromString(state, new string[0]);
gridState.ApplyStateFromStringAsync(state, new string[0]);
}
}
}
Expand Down Expand Up @@ -954,7 +964,7 @@ this.state.applyState(state, ['filtering', 'rowIslands']);
<!-- Blazor -->
`GetState` API は、`Selection``Sorting` を除くすべてのグリッド (ルート グリッドと子グリッド) 機能の状態を返します。開発者が後ですべてのグリッドの `Filtering` 状態のみを復元するには、以下を使用します。
```razor
gridState.ApplyStateFromString(gridStateString, new string[] { "filtering", "rowIslands" });
gridState.ApplyStateFromStringAsync(gridStateString, new string[] { "filtering", "rowIslands" });
```
<!-- end: Blazor -->
<!-- ComponentEnd: HierarchicalGrid -->
Expand Down Expand Up @@ -1102,9 +1112,13 @@ state.applyState(gridState.columnSelection);
* `GetState` メソッドは、JSON.stringify() メソッドを使用して、元のオブジェクトを JSON 文字列に変換します。JSON.stringify() が関数をサポートしないため、`GridState` ディレクティブは、columns `Formatter``Filters``Summaries``SortStrategy``CellClasses``CellStyles``HeaderTemplate` および `BodyTemplate` プロパティを無視します。
<!-- end: Angular -->

<!-- Blazor, React, WebComponents -->
<!-- React, WebComponents -->
* `GetStateAsString` メソッドは、JSON.stringify() メソッドを使用して、元のオブジェクトを JSON 文字列に変換します。JSON.stringify() が関数をサポートしないため、`GridState` コンポーネントは、列の `Formatter``Filters``Summaries``SortStrategy``CellClasses``CellStyles``HeaderTemplate` および `BodyTemplate` プロパティを無視します。
<!-- end: Blazor, React, WebComponents -->
<!-- end: React, WebComponents -->

<!-- Blazor -->
* `GetStateAsString` メソッドは、JSON.stringify() メソッドを使用して、元のオブジェクトを JSON 文字列に変換します。JSON.stringify() が関数をサポートしないため、`GridState` コンポーネントは、列の `Formatter``Filters``Summaries``SortStrategy``CellClasses``CellStyles``HeaderTemplate` および `BodyTemplate` プロパティを無視します。
<!-- end: Blazor -->

<!-- ComponentEnd: Grid, HierarchicalGrid, TreeGrid -->

Expand Down

0 comments on commit b508f71

Please sign in to comment.