We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GGC - performance on updating column values

Hi, How to get the best performance when update a column value for the entire grid? The code below is very slow even with just a couple thousand records. for (int i=0; i
1 Reply

AD Administrator Syncfusion Team September 28, 2005 11:45 PM UTC

Jan, try to handle the SourceListListChanged event. In the event handler you can give the engine couple of instructions what to do when it receives the ListChanged event (which occurs because of the record column change...). bool inUpdatingFields = false; // set this before changing values and reset it afterwards void yourUpdateMethod() { inUpdatingFields = true; foreach (SelectedRecord sr in this.grid.Table.SelectedRecords) { sr.Record.setValue(columnName, newValue); } inUpdatingFields = false; this.grid.Refresh(); } protected override void ggc_SourceListListChanged(object sender, TableListChangedEventArgs e) { if (e.ListChangedType == ListChangedType.ItemChanged && inUpdatingFields) { // Set this false if changes in values do not change sort order of parent groups (this is the case only if sort by summary values of groups). e.ShouldInvalidateGroupSortOrder = false; // If record changes do not affect filter logic and summaries set this false. e.ShouldInvalidateCounters = false; // If sort order of records is affected then setting // these value to false will have no effect. The engine will always invalidate its counters in that case. e.ShouldInvalidateSummaries = false; // GridTableControl listens to SourceListRecordChanged event and will execute the following code: // if (e.SortedPositionChanged) // tableControl.Invalidate(); // else if (e.TableListChangedEventArgs.ShouldInvalidateScreen) // { // ViewLayout.Reset(); // InvalidateElement(e.Record); // } // Setting e.TableListChangedEventArgs.ShouldInvalidateScreen = false will prevent the ViewLayout.Reset // and InvalidateElement calls from happening and we can implement a more optimized way to redraw these elements. e.ShouldInvalidateScreen = false; // let''s do our own drawing if sort order is not affected (or let''s do no drawing at all and simply call Update at the end) } Stefan >Hi, > >How to get the best performance when update a column value for the entire grid? The code below is very slow even with just a couple thousand records. > > >for (int i=0; i{ > this.grid.Table.SelectedRecords[i].Record.setValue(columnName, newValue); >} >this.grid.Refresh(); > >Regards, >NJ >

Loader.
Live Chat Icon For mobile
Up arrow icon