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

refactor(react-grid): switch to column extensions in LocalSorting #603

Merged
merged 2 commits into from
Dec 27, 2017
Merged

refactor(react-grid): switch to column extensions in LocalSorting #603

merged 2 commits into from
Dec 27, 2017

Conversation

kvet
Copy link
Contributor

@kvet kvet commented Dec 20, 2017

BREAKING CHANGES:

We removed the getColumnCompare property from the LocalSorting plugin to improve API consistency. Now, use the columnExtension property to specify individual column sorting options.

Before:

const columns = [{ name: 'field' }, { name: 'field2' }];
const fieldCompare = /* custom sort compare */;
const getColumnCompare = (columnName) => {
  if (name === 'field') return fieldCompare;
};

<Grid columns={columns}>
  <LocalSorting getColumnCompare={getColumnCompare} />
</Grid>

After:

const columns= [{ name: 'field' }, { name: 'field2' }];
const fieldCompare = /* custom sort compare */;
const localSortingColumnExtensions = [
  { columnName: 'field', compare: fieldIdentity },
];

<Grid columns={columns}>
  <LocalSorting columnExtensions={localSortingColumnExtensions} />
</Grid>


const pluginDependencies = [
{ pluginName: 'SortingState' },
];

export class LocalSorting extends React.PureComponent {
render() {
const { getColumnCompare } = this.props;
const { columnExtensions } = this.props;
const getColumnCompare = columnName =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we change getColumnCompare to columnCompare?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I left the getColumnCompare name in order to make it consistent across local processing plugins.

@kvet kvet requested a review from viterobk December 21, 2017 10:46
@viterobk viterobk requested review from dirk-pieterse and YanaOrlova and removed request for dirk-pieterse December 22, 2017 09:16
Copy link

@YanaOrlova YanaOrlova left a comment

Choose a reason for hiding this comment

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

Looks good

@kvet kvet merged commit 08c96da into DevExpress:master Dec 27, 2017
@kvet kvet deleted the local-sorting-column-extension branch December 27, 2017 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants