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

[DataGrid] Allow to control visibility of columns shown in ColumnsPanel #8401

Merged
merged 5 commits into from Apr 3, 2023

Conversation

@MBilalShafi MBilalShafi added component: data grid This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature labels Mar 27, 2023
@MBilalShafi MBilalShafi self-assigned this Mar 27, 2023
@mui-bot
Copy link

mui-bot commented Mar 27, 2023

Netlify deploy preview

Netlify deploy preview: https://deploy-preview-8401--material-ui-x.netlify.app/

Updated pages

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 789.1 1,336.8 789.1 1,013.06 234.712
Sort 100k rows ms 690.1 1,588.9 1,262.2 1,181.88 289.494
Select 100k rows ms 293.3 412 369 354.9 42.034
Deselect 100k rows ms 199.2 308.2 268.8 253.26 40.732

Generated by 🚫 dangerJS against c05f261

@MBilalShafi MBilalShafi marked this pull request as ready for review March 27, 2023 04:56
Comment on lines 175 to 191
const togglableColumns = getTogglableColumns ? getTogglableColumns(sortedColumns) : null;

if (!searchValue) {
return sortedColumns;
return togglableColumns
? sortedColumns.filter(({ field }) => togglableColumns.includes(field))
: sortedColumns;
}
const searchValueToCheck = searchValue.toLowerCase();
return sortedColumns.filter((column) => searchPredicate(column, searchValueToCheck));
}, [sortedColumns, searchValue, searchPredicate]);
return sortedColumns.filter((column) => {
if (togglableColumns) {
return (
togglableColumns.includes(column.field) && searchPredicate(column, searchValueToCheck)
);
}
return searchPredicate(column, searchValueToCheck);
});
}, [sortedColumns, searchValue, searchPredicate, getTogglableColumns]);
Copy link
Member

Choose a reason for hiding this comment

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

Opportunity to simplify this code?

const togglableColumns = getTogglableColumns ? getTogglableColumns(sortedColumns) : null;
const togglableSortedColumns = togglableColumns
  ? sortedColumns.filter(({ field }) => togglableColumns.includes(field))
  : sortedColumns;
if (!searchValue) {
  return togglableSortedColumns;
}
const searchValueToCheck = searchValue.toLowerCase();
return togglableSortedColumns.filter((column) => searchPredicate(column, searchValueToCheck));

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DataGrid] How to hide grouped column from visible columns panel
3 participants