score:2
I have resolved this problem. The workaround is here.
so onClick of a button I called my showActive() function which is responsible to make the column ( 1st in my case ) editable exactly as react data grid does.
1st make the column editable, ReactDataGrid takes "editable" as input function. allowEdit is to check if this column is editable. For me I wanted to make the cell editable only upon new row creation.
Create new obj to insert as the new row in the table. Like this -
let newRow = [
{
created: milliseconds,
absPath: this.props.dirSelectedPath,
modified: milliseconds,
size: 0,
filename: folderName,
type: "FILE_DIR",
allowEdit: true
}
];
Then below is the column configuration of the editable cell.
const columns = [
{
key: 'name',
name: 'Name',
resizable: true,
sortable: true,
filterable: true,
editable: function (rowData) {
return rowData.allowEdit ? true : false;
}
}
];
Now you have to write a function to show the cell highlighted and active. To do so I called the same function as react data grid calls.
get the handle of grid.
<ReactDataGrid showActive={this.showActive.bind(this)} rowsCount={this.getSize()} ref={node => this.grid = node} {...this.props } />
showActive() {
let length = this.getSize(); // get the length of the grid i.e number of rows
let obj = { idx: 0, rowIdx: length };
let promise = new Promise(function (resolve, reject) {
if (this.grid) {
resolve("this worked!");
}
}.bind(this));
promise.then(function () {
this.grid.onSelect(obj);
this.grid.setActive('Enter');
}.bind(this), function () {
});
}
hope the helps.
Source: stackoverflow.com
Related Query
- How to make react data grid table cell editable and focused on click of a button without performing a double click action
- How to make one table record editable on button click in React when the table record is mapped?
- I have buttons and a textbook in my React App, How do I make the click of the button trigger text input?
- How to make a row editable on click of a button in React bootstrap table?
- How to concatenate URL and string, and get data from API at click a button using axios in REACT JS
- how to make click button in bootstrap and all data are come API
- how to add Row Span in dynamic Json Table React JS and table cell data comparison
- how to make material data grid width to fill the parent component in react js
- How to make some columns align left and some column align center in React Table - React
- How can I find and click a button that has no text using React Testing Library?
- How to make the row editable when clicking on an "Edit" button on a cell with react-table
- How to make the API call and display it in React JS using React Table and Axios?
- How to edit react bootstrap table and save data after editing
- In React and Material-UI how do I make my Grid items take up 100% of available horizontal space w/o wrapping to the next row?
- How can I make my input field prefilled with data and editable on page load?
- How to add a tab dynamically when we click a button using React js and Bootsrap 4
- How to fetch data on page load and then on button click with useEffect
- React - how to handle a cell click of a specific column of a datagrid table of material ui?
- How to fix my React Context to render useEffect and reload table data
- How to make a react table whose rows and columns come from a JSON object
- how should we convert string data into array and display into react table
- How to make some columns fixed and some columns draggable in React Table - ReactJS
- How to pass data by button click in redux react js
- How to Create a dropdown Button with see more option and on click toggle should not happen in react js?
- How to make a column as clickable in a react bootstrap table and avoid showing it as text field in "Add Row"?
- How to get data from table row click using Semantic's React Table Component
- React table - how to merge tables for specific column and cell value
- React - edit profile -first display read only fields and click on edit make fields editable
- How to add right click menu to react table row, and access its properties?
- How to make a react component that can be rendered with no data and later rendered with data?
More Query from same tag
- how to pass props through a Link from react-router-dom?
- How to pass in field of undefined to children as props
- Uncaught Error: A cross-origin error was thrown. React doesn't have access to the actual error object in development
- Sending data back from node server back to react frontend
- Spacing and Margin Utility in React-Bootstrap
- Why is it showing white space when I scroll?
- Using fetch api to post in react
- Life cycle transform in hooks for a functional component
- Getting React flow error: module is not a polymorphic type. How to extend a class?
- Server-side rendering with React Router "Browser history needs a DOM"
- React-Redux access props inside a nested object within component
- If you want to write it to the DOM, pass a string instead: w="true" or w={value.toString()}
- How to unit test a React functional component using hooks useEffect,useDispatch and useSelector and Redux?
- Unable to return user from service model
- Paperclip Unpermitted parameter: image
- Submitting a form to Rails with ReactJS
- How to create a RadioButtonGroup with "pure" react?
- how to update array of objects in reactjs
- Babel + Jest Configuration
- Netflix Falcor working together with Immutable.js?
- How do I use aysnc/await in this superagent call?
- Material-UI set <Select> to be as wide as widest <MenuItem>?
- Initialize component with Async data
- Custom CSS Support for NextJS
- How to get a report like page views, how long a user spends time for a specifice page on google analytics? Not a general report
- I have an import export error in react-redux boiler plate
- How to write requests and fetch
- In React, how to memorize an inline function when using functional components?
- How to handle multiple windows in Electron application with React.JS?
- Problem with Redux stored data in showing in table