onRowsDelete
onRowsDelete: (data) => { console.log( data ) }, i have done this. i want to customize that and don't allow to delete rows of that table How can i do that??
or if i select any rows i want to disable the delete button ?? i tried with customize toolbar still its not working
It's too late to make any changes in onRowsDelete method. You can solve that using custom ToolbarSelect like this:
options = {
customToolbarSelect: (selectedRows, displayData, setSelectedRows) => (
<React.Fragment/>
),
}
React.Fragment will not add unnecessary elements to your DOM.
why it is too late ?
@RutulDarji because your rows already disappeared from the table didn't they? onRowsDelete is callback after delete actually. Isn't solution with customToolbarSelect suitable for your case?
I am working on local machine so delete rows not affect that much
customToolbarSelect works for me but what happen after i completed my task i have clear all my states but the previously selected times like .. i have selected 2 rows and it shows on header that 2 rows selected after the completion of the task i have cleared all my states so in react it will re render but the 2 rows selected still stay at table header.. I found out why this happend because onRowsSelect: (cur, all) the value of all doesn't chaange event after the refresh
There is another option rowsSelected - you can map it to your state and according to your words clear that as well
Sorry, I don't understand.
Example:
columns[id,value]
data are from external API and it will be something like this:
{id:123, value:value1}{id:678, value:value2} ecc...
Imagine you have many rows ...
With onRowsDelete I have back only the index of the table and the array of selection....
onRowsDelete:(rows)=>{console.log(rows)}
I have in console
data: Array[1]
0: Object
index: 1
dataIndex: 1
but i need to have my id not the index of the row of the table.... suppose I selected my first row I'd expect something: data: Array[1] 0: Object index: 1 dataIndex: 1 id:123 value:value1 so that I can remotely delete the record with the selected id
or alternatively Can I recover with index that I have in return from onRowsDelete the value of my id column in the table?
I've got a PR up that might help. The idea is that returning false from onRowsDelete will prevent a delete action from taking place. There will be an example in the code to demonstrate this as well.
I've got a PR up that might help. The idea is that returning
falsefromonRowsDeletewill prevent a delete action from taking place. There will be an example in the code to demonstrate this as well.
Thank You @gabrielliwerant