I'm designing a data table which needs to provide functionality of being able to paste data rows copied from excel. However, the onPaste event won't fire in Internet Explorer. I was able to achieve this and fetch clipboard data in chrome.
<Table className={classes.table} aria-labelledby="tableTitle">
<EnhancedTableHead
numSelected={selected.length}
order={order}
orderBy={orderBy}
onSelectAllClick={this.handleSelectAllClick}
onRequestSort={this.handleRequestSort}
rowCount={data.length}
/>
<TableBody onPaste={event => this.handlePaste(ClipboardEvent)}>
{stableSort(data, getSorting(order, orderBy))
.map(n => {
const isSelected = this.isSelected(n.id);
return (
<TableRow
hover
onClick={event => this.handleClick(event, n.id)}
role="checkbox"
aria-checked={isSelected}
tabIndex={-1}
key={n.id}
selected={isSelected}
>
<TableCell padding="checkbox">
<Checkbox checked={isSelected} />
</TableCell>
<TableCell component="th" scope="row" padding="none">
{n.udf}
</TableCell>
<TableCell align="right">{n.ticker}</TableCell>
<TableCell align="right">{n.transType}</TableCell>
<TableCell align="right">{n.qty}</TableCell>
<TableCell align="right">{n.portfolio}</TableCell>
</TableRow>
);
})}
{emptyRows > 0 && (
<TableRow style=>
<TableCell colSpan={6} />
</TableRow>
)}
</TableBody>
</Table>
Aucun commentaire:
Enregistrer un commentaire