mui-x icon indicating copy to clipboard operation
mui-x copied to clipboard

[data grid] Add native data grid `time` column type

Open Zenoo opened this issue 2 years ago • 7 comments

Duplicates

  • [X] I have searched the existing issues

Latest version

  • [X] I have tested the latest version

Summary 💡

We should be able to use time as a native column type.

The filters can stay the same, the only difference would be to only use a time picker instead of the date time picker used for dateTime.

I'd be happy to work on it if you would point me to where the modifications should be made.

Examples 🌈

No response

Motivation 🔦

date and dateTime are already available as native column types, it's been amazing to be able to use them in my projects.
Since I use a display a lot of time variables in my projects, this would save a lot of custom code.

Order ID 💳 (optional)

No response

Zenoo avatar Jul 07 '22 17:07 Zenoo

To add a new column type, you can have a look at this folder in which all the default types are defined

https://github.com/mui/mui-x/tree/master/packages/grid/x-data-grid/src/colDef

The first step could be to create a column definition based on type: 'dateTime' and spread it into the column definition https://mui.com/x/react-data-grid/column-definition/#custom-column-types

alexfauquette avatar Jul 08 '22 10:07 alexfauquette

@alexfauquette Thanks, I think I did all that in the PR I made for this issue, but the scope of this repo is so big, I'm kinda out of my depths here.
I'm not sure I made every modification needed for this new column type.

Zenoo avatar Jul 08 '22 10:07 Zenoo

Sorry, I did not see you already opened a PR 🙈

alexfauquette avatar Jul 08 '22 10:07 alexfauquette

Hello, any update about the time column type?

ETzaf avatar Sep 15 '23 11:09 ETzaf

I think it got forgotten #5422 mostly because it's not sure what kind of interface to use to edit time cells

But from that time we got the <TimeField/> component (see here) which could be more apropriate

alexfauquette avatar Sep 19 '23 07:09 alexfauquette

Thank you for your response, the feature that i looking for is a time filter at the DataDridPro columns like the date type filter.

ETzaf avatar Sep 19 '23 08:09 ETzaf

I'd love to see this implemented. I've spent much of the afternoon trying to cobble together an editable time-only column in a React MUI Data Grid with no luck.

Being able to set "time" as the type for the column instead of just "datetime" would be amazing.

neilenns avatar Feb 05 '24 03:02 neilenns