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
close icon

Sorting GDBG via code causes slow repainting

I am currently evaluating your product & have a few questions. 1) When changing the datasource bound to a grid & invoking SortColumn() the grid repaints itself much more slowly than when sorting by clicking on a column. You can briefly see the default column properties before they are overridden. See the attached example. 2) If you don''t set the DataSource to null before reassigning it & the new DataSet has no records, the grid generates a message saying "Column xx does not belong to the table xx" when leaving any field in a new record. Why is this? See comments in the example. 3) Is it necessary to set up the column properties (e.g. HeaderText, width, StyleInfo)for the grid each time the DataSet is populated with a new selection? 4)Can the CurrentCellValidating event be assigned to a GridBoundColumn. For example, I would like to be able to have automatic checking for cells in a date column. Otherwise, the product is looking very good. Thanks, Mick TestSort_5625.zip

3 Replies

AD Administrator Syncfusion Team July 15, 2004 10:12 AM UTC

Hi Mick Please check the sample again, I''m modifying some code in the LoadData method. Regards Thomas TestSort_5625_3410.zip


AD Administrator Syncfusion Team July 15, 2004 10:20 AM UTC

Here is your sample back with your code tweaked a little to avoid the problems you listed. There are comments in the code. 1) Sorting causes IBlindingList.ListChanged to fire with a Reset. The grid responds by cancelling any BeginUpdate so it can respond and redraw teh grid required by Reset. This is way you are seeing the major flickering. One solution as implemented in the returned sample is to just do the sort before you set the datasource. (There are other ways to do this, but they require significantly more code than this simple solution if it works for you.) 2) As the grid''s datasource is set, the currencymanager position is attempted to be placed on a valid position in teh table. In this empty case, there is no such valida poistion, and this leads to the problem you are seeing. The wrok-around of setting the DataSource to null resets teh currencymanager as well and avoid the problem. Another solution (that is in teh returned sample), is to explicitly set teh curencymanager position in this case. 3) Not unless the new query has different attribuits. In the returned sample, a firstTime bool value was added so the GridBoundColumns are only set once. 4) No. If you want to do this, you can derive GridBoundColumn, and in its constructor, subscribe to grid.CurrentCellValidating and handle things in that way. testsort_7437.zip


MS Mick Speake July 15, 2004 01:36 PM UTC

Many thanks for your quick & informative reply. I have decided to buy the product. However, re. 3) it looks like I do have to apply the HeaderText & CellType changes each time. Using the firstTime bool method results in the HeaderText & celltype changing back to the default after the Datasource is reset. Regards, Mick >Here is your sample back with your code tweaked a little to avoid the problems you listed. There are comments in the code. > >1) Sorting causes IBlindingList.ListChanged to fire with a Reset. The grid responds by cancelling any BeginUpdate so it can respond and redraw teh grid required by Reset. This is way you are seeing the major flickering. One solution as implemented in the returned sample is to just do the sort before you set the datasource. (There are other ways to do this, but they require significantly more code than this simple solution if it works for you.) > >2) As the grid''s datasource is set, the currencymanager position is attempted to be placed on a valid position in teh table. In this empty case, there is no such valida poistion, and this leads to the problem you are seeing. The wrok-around of setting the DataSource to null resets teh currencymanager as well and avoid the problem. Another solution (that is in teh returned sample), is to explicitly set teh curencymanager position in this case. > >3) Not unless the new query has different attribuits. In the returned sample, a firstTime bool value was added so the GridBoundColumns are only set once. > >4) No. If you want to do this, you can derive GridBoundColumn, and in its constructor, subscribe to grid.CurrentCellValidating and handle things in that way. >testsort_7437.zip > >

Loader.
Live Chat Icon For mobile
Up arrow icon