DraggableList
DraggableList component.
Exemples
export const DraggableListTest = () => {
const [rows, setRows] = React.useState();
const handleChange = (sortedRows) => {
console.log('in handleChange, sortedRows is :', sortedRows);
setRows(sortedRows);
}
const draggableListRows = [
{
label: 'first row',
username: 'A'
},
{
label: 'second row',
username: 'B'
}
];
return (
<DraggableList
onChange={handleChange}
rows={draggableListRows}
renderer={(row) => <div>Test {row.label}</div>}
/>
);
};
<DraggableListTest />
Test first row
Test second row
Props
Name | Type | Required | Default | Description |
---|---|---|---|---|
onChange | function | Yes | - | Callback function triggered when the list of rows have been sorted. |
rows | Array | Yes | - | The list of rows that must be sorted. |
renderer | function | Yes | - | Function that is rendering for each row a React Node |