Advertisement
minafaw3

remove_custom_columns

May 4th, 2023
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. const handleDeletionForCustomColumns = () => {
  2. const currentFilterModel = gridRef?.current?.api?.getFilterModel();
  3. if (currentFilterModel && !_.isEmpty(currentFilterModel)) {
  4. const customColumns = columns?.filter((colDef: ColDef) =>
  5. colDef.colId?.match(/^column.*$/)
  6. );
  7. const filterKeys = Object.keys(currentFilterModel).filter((key) =>
  8. /^column.*$/.test(key)
  9. );
  10. const validFilterKeys = filterKeys.filter((key) =>
  11. customColumns.some((col) => col.colId === key)
  12. );
  13. }
  14. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement