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, 3 months ago by edwardsmarkff.
-
AuthorPosts
-
August 16, 2022 at 7:26 pm #103500edwardsmarkffParticipant
hello – 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 #103502edwardsmarkffParticipanthere 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, 3 months ago by edwardsmarkff.
August 17, 2022 at 7:27 pm #103504edwardsmarkffParticipantthis 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, 3 months ago by edwardsmarkff.
- This reply was modified 2 years, 3 months ago by edwardsmarkff.
August 18, 2022 at 8:42 am #103507ivanpeevskiParticipantHi,
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 #103509edwardsmarkffParticipantis 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, 3 months ago by edwardsmarkff.
August 19, 2022 at 11:23 am #103511ivanpeevskiParticipantHi,
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 #103512edwardsmarkffParticipant<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, 3 months ago by edwardsmarkff.
- This reply was modified 2 years, 3 months ago by edwardsmarkff.
August 20, 2022 at 1:17 am #103515edwardsmarkffParticipantor another dumb question: would it be possible perhaps in a future release to also include the deleted row with the onRowRemoved() callback ??
-
AuthorPosts
- You must be logged in to reply to this topic.