mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2025-10-16 11:55:39 +00:00
patch row event example
This commit is contained in:
parent
bd410e7303
commit
41cc6b01af
@ -1,5 +1,5 @@
|
|||||||
/* eslint no-unused-vars: 0 */
|
/* eslint no-unused-vars: 0 */
|
||||||
/* eslint no-alert: 0 */
|
/* eslint no-console: 0 */
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import BootstrapTable from 'react-bootstrap-table-next';
|
import BootstrapTable from 'react-bootstrap-table-next';
|
||||||
@ -21,7 +21,10 @@ const columns = [{
|
|||||||
|
|
||||||
const rowEvents = {
|
const rowEvents = {
|
||||||
onClick: (e, row, rowIndex) => {
|
onClick: (e, row, rowIndex) => {
|
||||||
alert(`clicked on row with index: ${rowIndex}`);
|
console.log(`clicked on row with index: ${rowIndex}`);
|
||||||
|
},
|
||||||
|
onMouseEnter: (e, row, rowIndex) => {
|
||||||
|
console.log(`enter on row with index: ${rowIndex}`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -41,7 +44,10 @@ const columns = [{
|
|||||||
|
|
||||||
const rowEvents = {
|
const rowEvents = {
|
||||||
onClick: (e, row, rowIndex) => {
|
onClick: (e, row, rowIndex) => {
|
||||||
alert(\`clicked on row with index: \${rowIndex}\`);
|
console.log(\`clicked on row with index: \${rowIndex}\`);
|
||||||
|
},
|
||||||
|
onMouseEnter: (e, row, rowIndex) => {
|
||||||
|
console.log(\`enter on row with index: \${rowIndex}\`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -50,7 +56,7 @@ const rowEvents = {
|
|||||||
|
|
||||||
export default () => (
|
export default () => (
|
||||||
<div>
|
<div>
|
||||||
<h3>Try to click on any rows</h3>
|
<h3>Try to click or hover on any rows</h3>
|
||||||
<BootstrapTable keyField="id" data={ products } columns={ columns } rowEvents={ rowEvents } />
|
<BootstrapTable keyField="id" data={ products } columns={ columns } rowEvents={ rowEvents } />
|
||||||
<Code>{ sourceCode }</Code>
|
<Code>{ sourceCode }</Code>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user