How to add input fields to Eui Data Grid

Hi,

I want to add input fields to my data grid.
Meaning in total I'll have 10 columns
After 3 columns data, I need 2 columns as input fields, and the values in the rest of the columns will depend on the values in the input fields in the previous 2 columns

Can I have custom input fields in Eui Data Grid?

Or should I design custom element, like a data grid?

Thanks

Hi @Sheereen

I think you can use this example of Eui Data Grid with check boxes as starting point for having inputs on cell: https://elastic.github.io/eui/#/tabular-content/data-grid-style-display#grid-row-classes

Thanks for the response

I have gone through it
That is for providing selection contexts for the data in the data grid right?

I want to have input fields in place of values in the datagrid

For my use case, is EuiTable a better option?

In the example it is showing how to handle the context for an input field like the checkbox.
Same logic applies to other types of input: what challenges are you facing with the implementation? Can you share a codesandbox with some code?

I tried to insert textfields in 2 columns,
by returning <EuiTextField ... /> inside renderCellValue() , if column id in [col1, col2].

So these are essentially not control buttons or inputs (https://elastic.github.io/eui/#/tabular-content/data-grid-schema-columns#control-columns:~:text=Props-,Control%20columns,-Control%20columns%20can)

I am getting the controls, but they loose focus when I enter a character in the field... because renderCellValue() gets called again

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.