[ ] bug report
[X] feature request
[ ] support request
Is it possible to disable a specific cell on the grid?
Hi @nicomfe, what do you mean by disabling?
Hide a cell? Make it readonly?
make it readonly
Any workaround?
@nicomfe @pidupuis any updates?
@dg92 Nope :/
You can use onCheckCellIsEditable prop to make some cells readonly.
checkCellEditable = ({ column, row }) => {
// Return true/false
};
render() {
return(
<ReactDataGrid ...
onCheckCellEditable={this.checkCellEditable}
/>
);
}
You can use
onCheckCellIsEditableprop to make some cells readonly.checkCellEditable = ({ column, row }) => { // Return true/false }; render() { return( <ReactDataGrid ... onCheckCellEditable={this.checkCellEditable} /> ); }
when defining checkCellEditable like so to make all cells editable:
checkCellEditable = ({ column, row }) => true
All cells are still read only.
You can use
onCheckCellIsEditableprop to make some cells readonly.checkCellEditable = ({ column, row }) => { // Return true/false }; render() { return( <ReactDataGrid ... onCheckCellEditable={this.checkCellEditable} /> ); }when defining
checkCellEditablelike so to make all cells editable:checkCellEditable = ({ column, row }) => trueAll cells are still read only.
@zebralight This disables the entire row, what about just particular cells (eg. A cell at column 1, row 2)
You can use
onCheckCellIsEditableprop to make some cells readonly.checkCellEditable = ({ column, row }) => { // Return true/false }; render() { return( <ReactDataGrid ... onCheckCellEditable={this.checkCellEditable} /> ); }when defining
checkCellEditablelike so to make all cells editable:checkCellEditable = ({ column, row }) => trueAll cells are still read only.
@zebralight This disables the entire row, what about just particular cells (eg. A cell at column 1, row 2)
Nevermind found out that you can utilize the editable prop in columns that takes the rowData prop and disable that certain column and row (cell) when the data changes.
columns = [
{
key: 'id',
name: 'ID'
},
{
key: 'location_id',
name: 'Location ID',
editable: function(rowData) {
return rowData.allowEdit === true;
}
}
]
You can use
onCheckCellIsEditableprop to make some cells readonly.checkCellEditable = ({ column, row }) => { // Return true/false }; render() { return( <ReactDataGrid ... onCheckCellEditable={this.checkCellEditable} /> ); }
Hi - Thanks for the solution. There is a typo in this example. In the ReactDataGrid JSX component, the onCheckCellEditable prop should be onCheckCellIsEditable.
Thanks!
Most helpful comment
You can use
onCheckCellIsEditableprop to make some cells readonly.