JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Data Grid › is there a delete event?
- This topic has 7 replies, 2 voices, and was last updated 2 years ago by
edwardsmarkff.
-
AuthorPosts
-
August 16, 2022 at 7:26 pm #103500
edwardsmarkff
Participanthello – is there a delete event?
i see that the “change” event works, but only when all the rows are deleted.
August 17, 2022 at 3:34 pm #103502edwardsmarkff
Participanthere is what i mean:
https://www.htmlelements.com/demos/grid/editing-dialog/
https://codepen.io/edwardsmarkf/pen/KKobVwj
i need to be able to determine which row was deleted by a jScript event.
-
This reply was modified 2 years ago by
edwardsmarkff.
August 17, 2022 at 7:27 pm #103504edwardsmarkff
Participantthis did not work:
for ( const [key, value] in document.getElementsByClassName('smart-icon-delete') ) { let thisVal = document.getElementsByClassName('smart-icon-delete')[key] ; . . . . console.log(thisVal); . . . . console.log (typeof thisVal) ; . . . . thisVal.addEventListener('click', (event) => { console.table(event); } ) }
-
This reply was modified 2 years ago by
edwardsmarkff.
-
This reply was modified 2 years ago by
edwardsmarkff.
August 18, 2022 at 8:42 am #103507ivanpeevski
ParticipantHi,
The onRowRemoved callback function is used for that.
Please note that it is set as a property, and not as an Event.
You can see an example here: codepen. The indexes of the row will be console logged.
Best Regards,
Ivan Peevski
Smart HTMLElements Team
https://www.htmlelements.com/August 18, 2022 at 6:23 pm #103509edwardsmarkff
Participantis it possible to get the data contained in the row? the function onRowRemoved() appears to lose the data.
so this does not seem to work for me:
https://codepen.io/edwardsmarkf/pen/JjLwzGQ
or does require a new function “onRowRemoving()” dedicated to me? 😂🤣😂🤣
-
This reply was modified 2 years ago by
edwardsmarkff.
August 19, 2022 at 11:23 am #103511ivanpeevski
ParticipantHi,
In this case, please see the example here: codepen
If the row was deleted with the delete command button, you can use the onCommand callback function to get the row index before it was deleted. It also allows you to cancel the row delete operation by setting command.handled = true;
Best Regards,
Ivan Peevski
Smart HTMLElements Team
https://www.htmlelements.com/August 19, 2022 at 3:30 pm #103512edwardsmarkff
Participant<span style=”text-decoration: underline;”>thank you very much.</span>
https://codepen.io/edwardsmarkf/pen/LYdqxWP 😁
i should think this would be necessary enough to require its own unique event: “onRowRemoving()” .
-
This reply was modified 2 years ago by
edwardsmarkff.
-
This reply was modified 2 years ago by
edwardsmarkff.
August 20, 2022 at 1:17 am #103515edwardsmarkff
Participantor another dumb question: would it be possible perhaps in a future release to also include the deleted row with the onRowRemoved() callback ??
-
This reply was modified 2 years ago by
-
AuthorPosts
- You must be logged in to reply to this topic.