Open 0xj0hnny opened 5 years ago
If you want to implement this in the library I would accept a PR for the following:
In the component's options, one should be able to set
Name | Type | Default | Description |
---|---|---|---|
selectableRows |
string | 'multiple' | Configure row selection. Options: 'single', 'multiple' or 'false' |
When "single" is selected:
When "multiple" is selected:
When "false" is selected:
Just a fix on @johnnyliang213 's code. But that was a nice enhancement suggestion, thank you.
const newSelectedRow = selectedRows.data[selectedRows.data.length -1]; // selectedRows.data.length > 1 ? selectedRows.data[1] : selectedRows.data[0];
const newSelectedIndex = parseInt(newSelectedRow.index);
const temp = {
data: newSelectedRow,
lookup: {}
};
temp.lookup[`${newSelectedIndex}`] = true;
//if (selectedRows.data.length > 1) {
selectedRows.data = [];
selectedRows.lookup = temp.lookup;
selectedRows.data = temp.data; //selectedRows.data.push(temp.data);
//}
Hi,
First of all, great job on implemented this library. Since the table does not support single row select. I have to implemented some custom code to enforce the single select for the table. Below are the code that I implemented.
Expected Behavior
Current Behavior
If I selected one row and then select another, the number of
rows selected
is 2, instead of 1. And unless I deselect the selected row to clear out the number. The number ofrows selected
stays at 2.Steps to Reproduce (for bugs)
Your Environment