Delete selected row from a table on click of delete button

Hi ,

I have a dynamic layout in which a table is there . The source of the table is a pagelist property. The requirement is to put a checkbox button and delete button at the end of each row . When a user selects one row and click on delete icon in the row , the row should be removed .

Now I have partially achieved this but one issue is there .

Logic the i have applied :(Data transform)

In For loop , I have applied when (.pySelected==true)&&(@countInPageList(true,pySelected,Primary.Pagelistname)=1) , then set .pyDeletedObject = true , and then remove the deleted objects .

Issue :

The issue is, even if I select checkbox , say, in 1st row and click on delete icon in 3rd row . It will still delete the selected row i.e. 1st row .

My ask is , how to tell pega that I am clicking on the 3rd row delete button , or any other row and not the selected one ?

Thanks in advance .

@AnanyaA2

Can you try this following thing? On the table click action, set a focus action. Then when the user clicks on the checkbox, the pzInsKey of the row will be present in the context. You can pass the key as a parameter into your delete logic to accurately select the correct row.

@AnanyaA2

you can add another flag on click of delete button and add this flag in your previous condition for deletion.

@AnanyaA2 Thank you for all the replies . The problem solved with the use of “Delete item” functionality .