Deleting records from underlying datasource that is bound to ggc very slow
I have a large flat datasource that is bound to a ggc. The ggc is grouped by one column via the GropDropArea. When the user selects the CaptionSummaryCell that represent a group and right-clicked, a context menu appears with the command, "delete records".
However, when I enumerate the RecordsInDetailCollection and called rec.Delete(), the process is painfully slow.
I'm not sure if this is a problem with the datatable (saw some posting about the datatable.remove(row) being very slow or a problem with the ggc.
However, when I enumerate the RecordsInDetailCollection and called rec.Delete(), the process is painfully slow.
I'm not sure if this is a problem with the datatable (saw some posting about the datatable.remove(row) being very slow or a problem with the ggc.
SIGN IN To post a reply.
5 Replies
AD
Administrator
Syncfusion Team
January 24, 2007 12:14 PM UTC
Hi James,
Thank you for being patience.
Please refer to the following sample which demonstrates the intend behavior. This can be achieved by handling the TableControlCellMouseDown event and by making the context menu to pop up on caption summary row.
The records in the group are deleted by using Delete method of the record. The BeginUpdate and EndUpdate methods of TableControl have been called to make the grid to stop drawing, when it is being updated.
Sample : SummaryInCaption.zip
Kindly let us know if you need any further assistance.
Have a nice day.
Best regards,
Madhan
Thank you for being patience.
Please refer to the following sample which demonstrates the intend behavior. This can be achieved by handling the TableControlCellMouseDown event and by making the context menu to pop up on caption summary row.
The records in the group are deleted by using Delete method of the record. The BeginUpdate and EndUpdate methods of TableControl have been called to make the grid to stop drawing, when it is being updated.
Sample : SummaryInCaption.zip
Kindly let us know if you need any further assistance.
Have a nice day.
Best regards,
Madhan
JB
James Blibo
January 24, 2007 05:09 PM UTC
BeginUpdate() and EndUpdate() seems to have speed things up. Thanks.
One problem though, when I check the recordcount of the underlying datasource, the record count still reflects the a vlaue that show that no records have been deleted.
One problem though, when I check the recordcount of the underlying datasource, the record count still reflects the a vlaue that show that no records have been deleted.
AD
Administrator
Syncfusion Team
January 25, 2007 09:48 AM UTC
Hi James,
Thank you for being patience.
In the following sample, the row count in dataset is being changed accordingly when deleting the records in the grid.
Sample : SummaryInCaption_25Jan07.zip
Are you using any database to populate in the grid? Then to reflect the changes to database, you need to update the data adapter for the changes made in the grid.
Kindly let us know if you need any further assistance.
Have a nice day.
Best regards,
Madhan
Thank you for being patience.
In the following sample, the row count in dataset is being changed accordingly when deleting the records in the grid.
Sample : SummaryInCaption_25Jan07.zip
Are you using any database to populate in the grid? Then to reflect the changes to database, you need to update the data adapter for the changes made in the grid.
Kindly let us know if you need any further assistance.
Have a nice day.
Best regards,
Madhan
JB
James Blibo
January 25, 2007 05:17 PM UTC
Hi Madham:
Let me explain whats happening in my case.
I have two ggc (an upper master ggc and a lower ggc).
There are no physical relationship between the two datasets in the two grids. When the user right-click an bring up a context menu in the top grip and performs an action, for example, delete an item in a cell, I want to dynamically select the records in the lower grid the meet the criteria specific in the upper grid cell and perform some action on those rows.
My problem is selecting those rows in the lower grid. How do I select records that meet a certain criteria in the lower grid based on some condition when the lower grid does not have focus?
Let me explain whats happening in my case.
I have two ggc (an upper master ggc and a lower ggc).
There are no physical relationship between the two datasets in the two grids. When the user right-click an bring up a context menu in the top grip and performs an action, for example, delete an item in a cell, I want to dynamically select the records in the lower grid the meet the criteria specific in the upper grid cell and perform some action on those rows.
My problem is selecting those rows in the lower grid. How do I select records that meet a certain criteria in the lower grid based on some condition when the lower grid does not have focus?
AD
Administrator
Syncfusion Team
January 29, 2007 09:59 AM UTC
Hi James,
Thanks for being patience.
An idea is to use the GridConditionalFormatDescriptor and selecting the records based on the condition. For example, consider the grid 1 is been deleted, a condition is executed in grid2 and records will be selected.
The following is the code snippet, please try it and let us know if you need any further assistance.
>>>>>>>>>>>>>>>>>>Code Snippet <<<<<<<<<<<<<<<<<<<<
this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended;
GridConditionalFormatDescriptor desc = new GridConditionalFormatDescriptor();
desc.Expression = "[CustomerID] LIKE 'A*'";
this.gridGroupingControl1.TableDescriptor.ConditionalFormats.Add(desc);
foreach (Record rec in this.gridGroupingControl1.Table.Records)
if (desc.CompareRecord(rec))
this.gridGroupingControl1.Table.SelectedRecords.Add(rec); >>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<
Kindly let us know if you need any further assistance.
Have a nice day.
Best regards,
Madhan
Thanks for being patience.
An idea is to use the GridConditionalFormatDescriptor and selecting the records based on the condition. For example, consider the grid 1 is been deleted, a condition is executed in grid2 and records will be selected.
The following is the code snippet, please try it and let us know if you need any further assistance.
>>>>>>>>>>>>>>>>>>Code Snippet <<<<<<<<<<<<<<<<<<<<
this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended;
GridConditionalFormatDescriptor desc = new GridConditionalFormatDescriptor();
desc.Expression = "[CustomerID] LIKE 'A*'";
this.gridGroupingControl1.TableDescriptor.ConditionalFormats.Add(desc);
foreach (Record rec in this.gridGroupingControl1.Table.Records)
if (desc.CompareRecord(rec))
this.gridGroupingControl1.Table.SelectedRecords.Add(rec); >>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<
Kindly let us know if you need any further assistance.
Have a nice day.
Best regards,
Madhan
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
-
JB James Blibo
- Jan 23, 2007 10:00 PM UTC
- Jan 29, 2007 09:59 AM UTC