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

GridFindReplaceDialogSink performance

I'm using the GridFindReplaceDialogSink class to find a specific row in my grids, and it works find most of the time. But I'm having a performance issue with grids with a large number or rows. If the current row is at the top of the grid and the row you are trying to find is at the bottem, it takes forever. I've been trying to find a way to find the row in the datasource with something like the datatable.rows.find() method and then manipulate the currecy manager to reflect the row in the grid, but no such luck.

2 Replies

AD Administrator Syncfusion Team October 30, 2003 05:23 PM UTC

Hi Scot, You need to implement your own IGridFindReplaceDialogSink. This allows you to customize to the exact behavior you need. In your case you will not want to let the grid loop through all cells of the grid. Instead you can take advantage knowledge you have about the underlying DataTable. If you search for values that are in the sort key of the DataView you can use the Find method. Another alternative would be to create a RowFilter and apply with something like dv.RowFilter = "City = 'Berlin'"; or in worst case you just loop through records in the underlying dataview and do a manual search there. Once you found the record you can then move the current cell with CurrentCell.MoveTo. The Find method should look something like this in your FindReplaceDialogSink: public bool Find(long key) { // Do Not loop through grid ... // Instead call DataView.Find of your underlying datasource // When find has found the correct record move the current cell to that record and return true } Stefan


AD Administrator Syncfusion Team October 30, 2003 05:33 PM UTC

Here is one technique that implements a find from scratch. In this sample, a GridDataBoundGrid with 20000 rows can return all occurrences of a string in less than 100 msecs on my system. It does so by copying the column to an arraylist, and using ArrayList.IndexOf to do the searching. Now th this simple implementation, this requires a full word match. But you can use a ListBox and ListBox.FindString to do 'startswith' searching.

Loader.
Live Chat Icon For mobile
Up arrow icon