Comments (9)
Here's an example where I reused the same source file and added an id
same as colDef.field
on the root div: https://codesandbox.io/s/loving-moon-t46z24
Hope it fulfills your need.
from mui-x.
Hey @Lioralon5,
Could you provide more details on how you are inserting the ID and what's its use?
A live example would be perfect. This codesandbox.io template may be a good starting point. Thank you!
from mui-x.
Hey @MBilalShafi
In this picture you can see the input fields I am talking about. They are activated with the "unstable_headerfilters" prop.
I am trying to insert an id to those elements:
I was not able to recreate the case in the code sandbox because I am using the pro plan comonent "DataGridPro"
from mui-x.
Thanks for the information.
You could use the DataGridPro
in the codesandbox (only downside is, it will show watermark)
Could you try and update this codesandbox example (uses Pro) with a minimal reproduction of your problem?
Also, do you intend to use the injected id
for some DOM manipulation or testing or some other purpose?
from mui-x.
@MBilalShafi Thank you for th quick replys.
The id is requested by our QA team that need it for automated testing with selenium.
Here is the sandbox: https://codesandbox.io/s/datagridpro-starter-forked-cll3hw
I just added two props, one to activate the filters and the other to insert the id. But with this way each input field has the same id, and I want them to be unique (and consistent)
from mui-x.
Just wondering if you could just use already available selectors to access the header filter cell, or is there a specific reason to use id
? It may save you the hassle of going ahead and adding an id
to each cell you need to test.
For example:
document.querySelector('[aria-rowindex="2"] [data-field="id"]')
would give you a header filter cell for the column with field id
.
Sidenote: aria-rowindex
represents the indexes starting from the header row (1, 2, ...). If you are using column grouping, you might need to target a different row index.
from mui-x.
@MBilalShafi You are right we can do that, we can use XPATH as well instead of id, but I was wondering if it's possible to insert an id directly to those elements?
from mui-x.
I am not aware of another direct way to do it. You could pass your own header filter cell slot with the additional logic (reusing the original one with the custom changes could be a feasible idea)
from mui-x.
@MBilalShafi Yeah I thought about that, but how do I actually reuse the original one and just add an id prop to it?
from mui-x.
Related Issues (20)
- [How to get column widths exact on resize within detail panel based on Data Grid columns] HOT 2
- [data grid] Is it possible to have tree data row children open and under that details panel? HOT 9
- [data grid] Same column in different column groups HOT 8
- ThemeProvider not provide Translation keys. HOT 2
- [Data Grid Premium - Cell Copy and paste] Copied content from cell doesnt mantain the sorting set in the data premium grid HOT 3
- [data grid] Copy and Paste content from cell selection doesn't maintain the sorting set HOT 3
- [charts] labels are incorrect in RTL HOT 3
- [data grid] New DataGrid header style not properly passed to header HOT 4
- [data grid] Pressing `Delete` key in a Boolean type cell, the value incorrectly resets to empty string HOT 6
- [data grid premium] Copy and Paste content from cell selection doesnt mantain the sorting set HOT 2
- [data grid] Copy and Paste content from cell selection doesnt mantain the sorting set HOT 4
- [all components] Remove all IE 11 support
- [pickers] Error loading AdapterDateFns with date-fns v3 in vite: Missing "./_lib/format/longFormatters" specifier in "date-fns" package HOT 2
- [data grid] Include password protection and set a custom file name for the exported Excel file HOT 4
- [data grid] Column's renderCell api parameter's type is from community version instead of pro version. HOT 1
- [charts] Default Gauge Pointer
- [data grid] Debounce header filter inputs for async server-side filtering and pagination HOT 1
- [charts] How to disable animation of SparkLineChart? HOT 1
- [data grid] filter on invalid date HOT 5
- [data grid] Autosizing does not work with custom cell renderer HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mui-x.