Thursday 1 April 2021

Part 12 : Deleting Employee Card

#2 Minutes Of Reading In this article I will show you how we can delete employee card on click of employee card.
I show in previous article, map function which iterate through each row in 2-D array.
To implement delete functionality, I have added one more input parameter to map function (index). Index is nothing but index of an array or employee card index. Which helps in deleting employee card.
Map function iterate through each row in 2-D array and index parameter is index of an 2-D array row. Index starts from 0 up to arrayLength-1. Here, example I showed is 3 row so index count should start from 0 to 2. For more details please check below screen at line number.
Source code available here
DeleteEmp arraow function created to delete employee card and called from Employee component. Basically from on click of div shown in below screen. Splice function from javascript remove requrested index row. Actually function accept two parameter requested rows and how mant row to delete. I have passed requested row as index and how many rows to delete is 1. As I Just wanted to delete clicked employee card only from all cards.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home