ListView Requery After Delete Operation


Author
Message
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
I have a ListView that is getting populated on a requery.  I am passing in the ListPopulating method (as recommended) one of the business objects on the form along with the BusinessCloneDataType.  This is working great.  Whereever I need to call the requery method of the ListView, I no longer care about parameters...I just call it.

After a user deletes a record successfully, I thought it would be a good idea to call that requery method.  So, after checking success on the delete and the save events, I call the requery method of the ListView.  The resulting list is wrong.  An entirely different customer is being displayed in the list (the customer comes from a call (PopulatedThroughEvent) in the RowPopulating event).  If I navigate away from the main BO and come back, the ListView shows the correct customer.  If I add a new record and call the requery method, the ListView show the proper customer.  Only the delete is doing this.  So, what am I doing wrong?

Thanks!
Bill

Replies
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Nope...not deleting the parent, just a child.  What I did to get around the problem was to explicitly refill the child BO.  That seems to have done the trick. 

That would work, but it is requireing another trip to the server.  I think that you probably called the DeletePrimarykey method instead of the DeleteCurrentRow.  The DeletePrimarykey method just "smokes" it from the server and doesn't update the BO.  However, the DeleteCurrentRow updates the internal data as well as the server, if you call it with a False, otherwise a Save must happen to commit the deleted record.

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
I was calling DeleteCurrentRow() without a parameter.  I was forced to add the Save() function to get things going, so I used your tactic, instead.  I am now calling DeleteCurrentRow(false).  No need to call Save(), anymore.  Also, in order to get around another issue that I was having I added another temporary BO into the mix so that the ListView would populate properly.  In the RowPopulating event I setup a new BO to reference the BO of the ListView, then I grabbed the foreign key index from the BO and retrieved the field I needed from the customer BO to fill in the name.

It is all quite simple after I worked it all out.  Took a little while.  The goal was to be able to see a list of items, select one, and provide add/edit/delete capabilities in the same window.  I attached an example of what I did.

Thanks for your help!  Have a great day!!
Bill

Attachments
example.JPG (135 views, 49.00 KB)
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Looks good, Bill! Smile
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search