Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Migrate sorting #233

Merged
merged 1 commit into from
Aug 29, 2020

Conversation

oliviertassinari
Copy link
Member

No description provided.

@oliviertassinari oliviertassinari added the docs Improvements or additions to the documentation label Aug 29, 2020
@@ -170,22 +164,22 @@ export const useSorting = (
order.push(row.id);
return order;
}, [] as RowId[]);
}, [originalOrder, apiRef]);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better not include the ref in the list of the dependencies. It's not needed and simpler without.

@oliviertassinari oliviertassinari merged commit 77685b3 into mui:master Aug 29, 2020
@oliviertassinari oliviertassinari deleted the docs-data-grid-v7 branch August 29, 2020 20:30

### Key assignment conventions

The above key assignments are defined in the context of Windows and Linux.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The above key assignments are defined in the context of Windows and Linux.
The above key assignments are for Windows and Linux.

@@ -50,10 +50,22 @@ Finally, you need to handle the `onPageChange` callback to load the rows for the

## apiRef

We exposed a set of methods that will let you achieve all the above features using the imperative apiRef.
The Grid exposes a set of methods that will let you achieve all the above features using the imperative apiRef.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The Grid exposes a set of methods that will let you achieve all the above features using the imperative apiRef.
The Grid exposes a set of methods that enables all of these features using the imperative apiRef.


> ⚠️ Only use this API when you have no alternatives. Always start from the declarative APIs the Grid exposes.
> ⚠️ Only use this API when you have no alternatives. Always start from the declarative API the Grid exposes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> ⚠️ Only use this API when you have no alternatives. Always start from the declarative API the Grid exposes.
> ⚠️ Only use this API when you have no alternative. Always start from the declarative API that the Grid exposes.

- `setPageSize`
- `setPage`
- `onPageChange`
- `onPageSizeChange`

Below is an example on how you can reset the page using the imperative `setPage` method.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Below is an example on how you can reset the page using the imperative `setPage` method.
This example shows how you can reset the page using the imperative `setPage` method.


Below is an example on how you can reset the page using the imperative `setPage` method.

{{"demo": "pages/components/data-grid/pagination/ApiRefPaginationGrid.js"}}

## Paginate > 100 rows ✨
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Paginate > 100 rows ✨
## Paginate > 100 rows ✨

"✨" = "new feature". If this is meant to indicate a premium feature, it needs a more appropriate icon. (See suggestions elsewhere).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mean to indicate premium, happy to use a different one, for now, the objective is to have at least one.


### Disable sorting

By default, columns are all sortable and it can be revoked using the sortable prop of the `ColDef` interface as below.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
By default, columns are all sortable and it can be revoked using the sortable prop of the `ColDef` interface as below.
By default, all columns are sortable. This can be revoked using the sortable prop of the `ColDef` interface:


### Server-side sorting

By default, sorting works on the client-side.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
By default, sorting works on the client-side.
By default, sorting works client-side.


By default, sorting works on the client-side.
To switch it to server-side, set `sortingMode="server"`.
Then, you need to handle the `onSortModelChange` callback, sort the rows on the server-side and update the `rows` prop with the new sorted rows.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Then, you need to handle the `onSortModelChange` callback, sort the rows on the server-side and update the `rows` prop with the new sorted rows.
Then you need to handle the `onSortModelChange` callback, sort the rows on the server-side, and update the `rows` prop with the newly sorted rows.


### apiRef

The Grid exposes a set of methods that will let you achieve all the above features using the imperative apiRef.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The Grid exposes a set of methods that will let you achieve all the above features using the imperative apiRef.
The Grid exposes a set of methods that supports all of the above features using the imperative apiRef.


The Grid exposes a set of methods that will let you achieve all the above features using the imperative apiRef.

> ⚠️ Only use this API when you have no alternatives. Always start from the declarative API the Grid exposes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> ⚠️ Only use this API when you have no alternatives. Always start from the declarative API the Grid exposes.
> ⚠️ Only use this API when you have no alternative. Always start from the declarative API that the Grid exposes.

@oliviertassinari
Copy link
Member Author

@mbrookes Great, I will handle the review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants