Hy!
I'm using a UltraDataSource object in order to load a custom object list into a WinGrid. And I'm looking for the best way to update a single row without having to reload the entire grid.
The thing is that the load process takes a while, and every time a property of my entity is modified the entire reload makes the application a little a annoying.
Why I'm using a UltraDataSource? Because the object is an interface, so in order to get all the properties of that object (including the inherited ones) I have to use a UltraDataSource.
Thanks, Luciano.
I don't think the UltraDataSource is working on demand. Is there any way to tell the UltraDataSource to work this way?
And I'm talling you this because all the info is loaded even when the grid's property LoadStyle=LoadOnDemand.
I tried using 'ResetCachedValues' in the UltraDataSource and all the info of the grid is cleared but it's not reloaded.
I tried using 'ResetCachedValues' in the DataRow and all the info of the row is cleared but not reloaded.
In both cases I used 'Refresh(RefreshRow.ReloadData, true)' but nothing happends.
Well, there are quite a few variables here. My guess is that you are loading the UltraDataSource on-demand and so when you change your entity, you need to tell the UltraDataSource to clear it's cached information so it picks up the new data. You would use the ResetCachedValues method for this.
Nop, nothing happends. I tried both, row and grid refresh methods and nothing happends.
I changed the entity but the changes doesn't be reflected.
Is there any property or method that I have to call in the UltraDataSource?
Thanks.
Hi,
Have you tried calling the Refresh method on the grid row?
If that doesn't help, then you will need to use grid.Rows.Refresh(ReloadData).
The thing is that I need to tell the grid that an entity was modified. Instead of reload the entire grid I want to update only the row that represent the modified entity.
By updating the entire grid I meen reloading the entire informacion from the database and setting it to the UltraDataSource.Datasource property. This process will take a while just for a simple entity change.
Updating sample:
public void RefreshClientAddress(int clientId, IAddress updatedAddress){ // GETTING THE CLIENT REFERENCE FROM THE DATASOURCE. IClient client = GetClientFromDataSource(clientId);
// REPLASING THE OLD ADDRESS REFERENCE WITH THE NEW ONE. client.Address = updateAddress;
// PLACE DATAGRID ROW UPDATE CODE HERE.}
As you can see, I update the address object reference, but the grid doesn't known that.