How do I delete multiple tabledata with checkboxes?

How do I delete multiple tabledata with checkboxes?

  

I'm trying to create an function to delete table rows that are selected with a checkbox. I already have a screen action with the entity DeleteProduct action between the start and end node. I have a delete button with a destination to this screen action. But the checkboxes need an boolean variable. How do I tell my delete screen action to only delete the selected products from the list??? Do i need to make a product list variable and put the selected items in that list first and then make a foreach that runs through that list and deletes those items???

Hi Oguzhan,

In your aggregate, add a new Source structure called Boolean
Now, your Table Record will have a new boolean field that you can bind to the Checkbox (Table.List.Current.Boolena.Value, if I am not mistaken).

In your action, do a ForEach in the TableRecord list and check if the fild is true. If it is, delete it. If not, go to next.

Cheers
Eduardo Jauch

Hi,

You don't. :)
Not easily anyway.

This is because when you build the page, the message is defined in the button and send to the browser. At this point, nothing is selected.

When the user mark a checkbox, the message is not changed. Than, when you click the button/link, the popup does not have the actual counter.

The EASIER (not best, probably) way of doing what you wants to do is to define the message in the button including a variable that is the counter of the checked.

Initially, it will be zero.

Than, in the check box, set a OnChange action.
In the action:
1. check if the variable is True (increment the counter) or False (decrement the counter).
2. Ajax Refresh the button (the message will be updated).

It is also possible to do this with JavaScript, of course.

Cheers,
Eduardo Jauch


I thought i fixed the delete function but I just discovered a bug.

When I select a product and switch pages through the pagination, It deletes the selected rows without me clicking the delete button..I think I'm doing something wrong in the screen action.

(Included in this post is my DeleteProduct Screen action) 


Eduardo Jauch wrote:

Hi,

You don't. :)
Not easily anyway.

This is because when you build the page, the message is defined in the button and send to the browser. At this point, nothing is selected.

When the user mark a checkbox, the message is not changed. Than, when you click the button/link, the popup does not have the actual counter.

The EASIER (not best, probably) way of doing what you wants to do is to define the message in the button including a variable that is the counter of the checked.

Initially, it will be zero.

Than, in the check box, set a OnChange action.
In the action:
1. check if the variable is True (increment the counter) or False (decrement the counter).
2. Ajax Refresh the button (the message will be updated).

It is also possible to do this with JavaScript, of course.

Cheers,
Eduardo Jauch



Never mind! Already fixed it, I still had the checkbox onchange destination on the deletefunction also..

Nice :)