Refreshing a collection after edit

Posts   
 
    
hplloyd
User
Posts: 191
Joined: 29-Oct-2004
# Posted on: 16-Feb-2005 15:17:53   

I have an enitity collection that I have bound to a janus grid. I dont let users edit the grid directly, they choose to either add, modify or remove an item from the grid. If the user selects to modify an entry, for example, then:

  1. I cast the relevant row in the collection to an entity class
  2. I set the EntityValidatorToUse property for the entity class created in 1
  3. I display a dialog populated with the current details
  4. The user makes changes and clicks ok
  5. I start a transaction
  6. I save the entity (which forces the validation)
  7. I record the changes made in a separate log data table
  8. I commit the transaction

My question is this.... how can I refresh the collection (and thus the grid) with the changes I have made without having to go back and requery the database? Is there an easy way to do this?

Many thanks for all of your help

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 16-Feb-2005 19:02:25   

grid.Refetch(); should do the trick, though the grid should update itself, as the entity changes will make the collection fire events that it is changed.

If you're using adapter, save the entity with refetch set to true.

Frans Bouma | Lead developer LLBLGen Pro