Deleting multiple rows with one confirmation


Author
Message
Peter Jones
Peter Jones
Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)
Group: Forum Members
Posts: 386, Visits: 2.1K
Hi,

If I select 5 rows in a grid (Devexpress) for deletion and hit delete StrataFrame asks me to confirm the delete of each row one at a time. Can I change this to delete all 5 in one hit?

Actually, the ideal would be to be able to select either confirm one at time or all at once at the BO level.

Cheers, Peter

StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
The problem is that the grid deletes each record individually, which calls DeleteCurrentRow() on the business object for each record that needs to be deleted.  What you'll need to do is turn off the AutoShowDeleteConfirmation and handle the delete event on the grid to show your own message.
Peter Jones
Peter Jones
Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)
Group: Forum Members
Posts: 386, Visits: 2.1K
Hi Ben,

Thanks for that. One (hopefully) minor issue remains - in the BO's BeforeDelete I want to display a message along the lines: "Confirm deletion of X rows". However I just can't find a BO Data Table or Data View property that tells me if a row is selected or not so I can calculate a value for X. Obviously it must be available for physical deletion process but I just can't identify where it is.

Cheers, Peter

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
There is only one indicator for a row selection in the BO and that is the CurrentRowIndex which is displayed in the CurrentRow.  This logic is left up to you as to know which rows are to be deleted.  If they are loaded into a List then you could delete all of the rows by PK which have been selected in the list.  There is nothing in the BO that allows you to "select." Now you can navigate through a BO and "mark: it for deletion back on the server without actually deleting until you call Save().  This is done by calling the DeleteCurrentRow(True) on the BO.
Peter Jones
Peter Jones
Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)
Group: Forum Members
Posts: 386, Visits: 2.1K
Hi Trent,

Thanks for that. Just to bring this thread up to date here's what I did:

1) Intercepted the delete button press on the (DevExpress) grid.

2) Checked if the BO's AutoShowDeleteConfirmation is False.

3) Is so fired my delete confirmation message and used the grid's SelectedRowsCount for delete record count.

4) If the user says ok to the delete then process as normal otherwise I cancel the button press event.

Cheers, Peter


Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Glad to hear you got it working Smile
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search