-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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] Improve sorting documentation page #3564
Conversation
These are the results for the performance tests:
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seem realy nice. I only read the markdown. I re-request my review to read example later
|
||
A sorted column can be can pre-configured using the `sortModel` prop: | ||
## Single and multi-sorting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section content is only about multi-sorting
## Single and multi-sorting | |
## Single and multi-sorting [<span class="plan-pro"></span>](https://mui.com/store/items/material-ui-pro/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We did not put the pro
label on the filtering because the section also contains the mention that the DataGrid does not handle multi filtering / multi sorting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point, @flaviendelangle. But I've just recently reviewed the license page, and because we mention there we'd add the label on pro (and premium) features, I agree we should consider adding the 'pro' label here.
Could we also consider making a patch for the filtering page regarding the changes we discuss here?
Having that said, I like the highlight box stating an important difference between the free and pro versions.
Perhaps we can leave this section as is and add a specific labeled section for the multi-sorting just after it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in favor of consistency
But if the best output is with the pro icon, then there is no problem adding it to the filter page at the same time 👍
Perhaps we can leave this section as is and add a specific labeled section for the multi-sorting just after it.
I added it to see based on https://github.com/mui-org/material-ui-x/pull/3564/files#r791072821 to see what it would look like.
If we agree it's better that way, I'll do the same for filtering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I think the preview is looking great.
|
||
{{"demo": "pages/components/data-grid/sorting/ControlledSort.js", "bg": "inline", "defaultCodeOpen": false}} | ||
|
||
## Disable the sorting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this section could be introduced before multi sorting because: It does not need to know the existence of multi-sorting, and it is simpler to understand than sorting model
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you have the same logic for filtering ?
I kept the same order between the two pages as the logic are similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know.
Having the same structure is clearly a good point (I was wondering why the flow seems familiar 😅)
I noticed it for this page (and not the filtering one) because here goes from a section with 3 subsections to a small section with one sentence + an example.
Let see if @joserodolfofreitas and @cherniavskii have an opinion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I understand both single and multi-sorting works out of the box without any explicit configuration.
it can't be easier than that ;)
Maybe we should add a comment on the demo code that the configuration is optional, or remove the configuration altogether. Although I understand it's useful to have the demo showing by default the sorted data, so we have to weigh on that too.
Another point I see: it's good to highlight this hot pro feature (single vs multi) on the beginning of the page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure to follow you here
or remove the configuration altogether
What configuration are we talking about ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, there's no configuration on the single sorting
and multi sorting
basic demos (great!). I may have mixed it with another one that sets a default sorting rule (which was the config I was referring to). My bad!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can disable the multi sorting on the pro
But I think this option mainly exist to limit on the free, we don't even document it 👍
Co-authored-by: Alexandre Fauquette <45398769+alexfauquette@users.noreply.github.com>
Co-authored-by: Alexandre Fauquette <45398769+alexfauquette@users.noreply.github.com>
Co-authored-by: Alexandre Fauquette <45398769+alexfauquette@users.noreply.github.com>
Co-authored-by: Alexandre Fauquette <45398769+alexfauquette@users.noreply.github.com>
Co-authored-by: Alexandre Fauquette <45398769+alexfauquette@users.noreply.github.com>
Co-authored-by: Alexandre Fauquette <45398769+alexfauquette@users.noreply.github.com>
Co-authored-by: Alexandre Fauquette <45398769+alexfauquette@users.noreply.github.com>
docs/src/pages/components/data-grid/sorting/OrderSortingPerColumnGrid.tsx
Outdated
Show resolved
Hide resolved
docs/src/pages/components/data-grid/sorting/ComparatorSortingGrid.tsx
Outdated
Show resolved
Hide resolved
docs/src/pages/components/data-grid/sorting/ComparatorSortingGrid.tsx
Outdated
Show resolved
Hide resolved
docs/src/pages/components/data-grid/sorting/ComparatorSortingGrid.tsx
Outdated
Show resolved
Hide resolved
docs/src/pages/components/data-grid/sorting/BasicExampleDataGrid.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Matheus Wichman <matheushw@outlook.com>
Co-authored-by: Matheus Wichman <matheushw@outlook.com>
Co-authored-by: Matheus Wichman <matheushw@outlook.com>
Co-authored-by: Matheus Wichman <matheushw@outlook.com>
…id.tsx Co-authored-by: Matheus Wichman <matheushw@outlook.com>
|
||
const VISIBLE_FIELDS = ['name', 'rating', 'country', 'dateCreated', 'isAdmin']; | ||
|
||
export default function BasicExampleDataGrid() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've noticed that country sorting doesn't work in this demo
Screen.Recording.2022-01-20.at.17.05.04.mov
I can reproduce it in storybook as well.
It seemed like an easy fix at first - just a matter of adding valueGetter
, so that column gets sorted by country label.
It didn't work though.
Adding valueGetter
broke renderCell
, since renderCell
now receives a string (returned by valueGetter
) instead of whole field object.
I did not expect that and at this point I'm not sure if that's intended.
I can extract it into a separate issue and investigate, so that this PR is not blocked by it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
A sorted column can be can pre-configured using the `sortModel` prop: | ||
## Single and multi-sorting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point, @flaviendelangle. But I've just recently reviewed the license page, and because we mention there we'd add the label on pro (and premium) features, I agree we should consider adding the 'pro' label here.
Could we also consider making a patch for the filtering page regarding the changes we discuss here?
Having that said, I like the highlight box stating an important difference between the free and pro versions.
Perhaps we can leave this section as is and add a specific labeled section for the multi-sorting just after it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's looking great!
I added just a small fix I missed on the "single vs multi" highlight box
Co-authored-by: José Rodolfo Freitas <joserodolfo.freitas@gmail.com>
Doc preview
Closes #1511
Package changes
Improve demos
filtering
, maybe we could make this basic dataset more universal and use it on every demo where we care about the columns content and not the columns amount or sizing,initialState
Improve paragraph order
Before:
After:
I have a few doubts on the titles of the sections
I tried to keep the order as close as the sorting one as possible to have a consistency.