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.
Hi Luciano,
I'm afraid I'm not sure what you are asking. If you update the values in a row of the UltraDataSource, then the UltraDataSource sends a notification to the BindingManager which will notify the grid and update the row.
What exactly do you mean when you say it's updating the entire grid? There's no reason that should be happening unless it's something in your code explicitly doing it.
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.
Thanks.