How to create and delete dynamic card view via unique value

I have searched of this particular topic but didn’t found any answer that can solve this requirement.

I want to create dynamic card view with unique id whenever user click on Button1 that is working fine but the main problem is that i can not delete it properly. only lastly created card view is being deleted.

I wanted to delete that particular card view whenever dynamic button inside that cardview is pressed. Can anyone have suggestion about how i can do that? Remember i have unique id for dynamic cardview and for dynamic button whenever user click on Button1. HERE IS THE BLOCKS WHICH I HAVE USED.

1 Like

Try setting the id in the button click event to the id variable and not to the card variable.

3 Likes

when you are creating a new component, keep adding ids into a list and then you will have better control on which id to delete.
If you want to delete all, just run a for each loop for on the list.

1 Like

try this:

1 Like

or @Mohamed_Tamer’s option.

1 Like

That exactly what i said.Any way you are setting the card var which he needs in another place in his program.That may be damage something i his program.

Sorry, i don’t see myself placing card var to a different place on the program. Where am i doing it? I just switched get to set and set to get.

1 Like

I have done that changes and it is working but not exactly. when i click on first dynamic button then also lastly created card view is being deleted.

1 Like

Please show your blocks now.

He is placing it while creating cards and not you

Also remove the set id to card.It will case problems in your code.

I don’t know why but my reply with the image of blocks was not approved :disappointed:

Here are the blocks

1 Like

Ok but you can use the id var directly. Actually setting card to id is useless.

1 Like

Thank you so much for prompt response but i am not getting your point as i am beginner. Can you please elobrate your explanation on this? I will be thankful of you.

Ok, you have a variable which is the id variable…Also you have another variable which is the card variable.
Now you’re trying to delete the card view according to its id.You set the card variable to the id variable then you set the id parameter in delete dynamic card view method to the card variable.Actually, its more easy to put the id variable in the id parameter in the delete method directly.That’s only my point.

Oh okay got you. Thanks for detailed explanation.

This is what i am trying to build. I think this could help you to understand more about my topic.

All components’ ids should be different each and every time when + button clicked and any of the components picked

You’re welcome :heart_eyes:
First one you can try with dynamic compnents ( i recommend dynamic components extension which can create dynamic any component or extension! with the same method that you started with.You can create the second one with a custom dialog and image and text list view.

I haven’t idea about dynamic component extension. I will try it and let you know. Thanks a lot for helping me out.