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

Performance tuning in gridGroupingControl

PerformanceTestProj_2000.zip Hi Clay, I am using gridGroupingControl. I have a requirenment of displaying maximum 50 cols and 10000 records. I have seen when I do the scrolling on the form using the scroll bar in the right side...gridGroupingControl is very slow.Also It scrolls in jerks. Pl suggest us how can we improve performance. We have observed QueryCellStyleInfo event is costly..whenever i scroll, for each record this event will be triggered. Also when I traverse from one row to other it is very slow. When I move from one row to other I check..whether is it only value change or other i.e. even if the checkbox is clicked, getChanges will get that row as modified. So I compare with the previous version value and current value. Only if both are not equal i call update method to database. I cud have added one condition if the change is from checkbox, not to fire SourcelistChanged event.But the scenario may be there, user modify row value and check checkbox also. Pl find the attached sample of the application we have developed. In the zipped file there are three projects. CommonUI - Common controls Used across all the projects in an organisation. ProjectControls - Controls used in specific project. Main - That call each contols. Thanks, Prathima

17 Replies

AD Administrator Syncfusion Team August 16, 2005 02:03 PM UTC

As far as thumbtracking scrolling, I do not know is there is much you will be able to do about this except to turn it off and use scrolltips. In your sample, you can do this by setting these properties and subscribing to an event. this.viewGridControl1.GroupingGrid.SyncfusionGridControl.TableControl.VerticalThumbTrack = false; this.viewGridControl1.GroupingGrid.SyncfusionGridControl.TableControl.VerticalScrollTips = true; this.viewGridControl1.GroupingGrid.SyncfusionGridControl.TableControl.ScrollTipFeedback += new ScrollTipFeedbackEventHandler(TableControl_ScrollTipFeedback);
private void TableControl_ScrollTipFeedback(object sender, ScrollTipFeedbackEventArgs e)
{
	Element el = this.viewGridControl1.GroupingGrid.SyncfusionGridControl.Table.NestedDisplayElements.GetItemAtYAmount(e.Value);
	if(el is GridRecordRow)
	{
		e.Text = ((GridRecordRow)el).ParentRecord.GetValue("Name").ToString();
	}
}


PV Prathima Venkobachar August 17, 2005 06:33 AM UTC

Thanks for the reply. I have made VerticalThumbTrack = false; Can you suggest performance improvement when I move from one row to the other.Update also takes time. Even to update one row it is taking more time. While update I am calling this.groupingGrid.Validate(); This code makes sourcelistChangedevent+ to trigger one more time. We have one more issue. tabbing in the grid doesn''t work properly. If I am in a first column and use tab key to move to next column, after two three tabs it goes to last column. Thanks, Prathima


AD Administrator Syncfusion Team August 17, 2005 09:31 AM UTC

The reason the update is taking so long is your call to: this.table.AcceptChanges(); in your event handler. This triggers a ListChangedType.Reset on the currencymanager which forces the grid to repaint the whole table. And this is done everytime you leave an edited row in the grid. If you comment out that line, there is no delay when leaving a row in your sample. Additionally, the DataRow in the DataTable is changed, and if other objects are using this DataTable, the will see the changes. If you really need the table.AcceptChanges call for your work, then you might have to derive the grid and do significant coding to try to avoid teh grid rsponding to this Reset message. I do not see the tabbing problem in your sample using our 3.3 code base.


PV Prathima Venkobachar August 17, 2005 10:40 AM UTC

Thanks for the reply. what do you mean by "derive the grid and do significant coding to try to avoid teh grid rsponding to this Reset message." How to do this..? to avoid repaintiing of the grid can we use gridGroupingControl.BeginUpdate(); this.dataTable.AcceptChanges(); gridGroupingControl.EndUpdate(); Thanks, Prathima


AD Administrator Syncfusion Team August 17, 2005 10:54 AM UTC

This will not work. >>gridGroupingControl.BeginUpdate(); this.dataTable.AcceptChanges(); gridGroupingControl.EndUpdate(); << The reason is that when the grid handles ListChanged.Reset it cancels any pending BeginUpdates. If you want to try to freeze the painting at this point, you can use a technique described in our Windows Forms Faq. It shows how you can add a FreezePainting property to any windows forms control, and turn off its painting by setting this property. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=9290 Adding the freezepainting property will be simpler than trying to derive controls to try to prevent the grid from responding to ListChanged.Reset. I will discuss this with teh grid architect later in the to see if there is something I am missing on how to avoid this reset problem.


PV Prathima Venkobachar August 17, 2005 11:06 AM UTC

I got the code : int paintFrozen; private const int WM_SETREDRAW = 0xB; [DllImport("User32")] private static extern bool SendMessage(IntPtr hWnd, int msg, int wParam, int lParam); private bool FreezePainting { get { return paintFrozen > 0; } set { if (value && IsHandleCreated && this.Visible) { if (0 == paintFrozen++) { SendMessage(Handle, WM_SETREDRAW, 0, 0); } } if (!value) { if (paintFrozen == 0) { return; } if (0 == --paintFrozen) { SendMessage(Handle, WM_SETREDRAW, 1, 0); Invalidate(true); } } } } But not clear where can I do this..? In my grid Control or form..? We are currently using 3.2.1.0 version. Is there a any way to solve tabing issue. Thanks, prathima


AD Administrator Syncfusion Team August 17, 2005 05:47 PM UTC

Using the FreezePainting did not help. We have added a new paremeter in the SourceListListChanged event that will allow you to conditionally have the grid ignore the Reset message. This change will be in the final 3.3 release. It is not in the release candidate though.


PV Prathima Venkobachar August 18, 2005 10:40 AM UTC

Thanks for all the info. It was very much usefull in analysing though we cudn''t do much to improve performance. We are currently using 3.2.1.0 version. Is there a any way to solve tabing issue. can you use this version and give solution..? Thanks, Prathima


AD Administrator Syncfusion Team August 18, 2005 01:18 PM UTC

This problem in corrected in 3.3. I was able to avoid it in 3.2.1 bu handling th eTabelControlCurrentCellKeyDown and doing the move from there. The snippet below should give you the idea. When you run this in debug, moving the currentcell with teh tab is slow, but it speeds up when you run release.
private void SyncfusionGridControl_TableControlCurrentCellKeyDown(object sender, GridTableControlKeyEventArgs e)
{
	if(e.Inner.KeyCode == Keys.Tab || e.Inner.KeyCode == Keys.Right)
	{
		GridCurrentCell cc = e.TableControl.CurrentCell;
		cc.MoveTo(cc.RowIndex, cc.ColIndex + 1);
		e.Inner.Handled = true;
	}
}


PV Prathima Venkobachar August 19, 2005 10:38 AM UTC

Thanks a lot for the information. Prathima


PV Prathima Venkobachar August 22, 2005 09:42 AM UTC

Hi, Tabbing is working fine with this code.It moving to all the columns in the grid. Is there any way we can check, when we press tab it should move to only next editable column. Thanks, Prathima


AD Administrator Syncfusion Team August 22, 2005 10:20 AM UTC

Inside TableControlCurrentCellKeyDown, you can use e.tableControl.Model[cc.RowIndex, cc.ColIndex + 1] to get the style of the target cell. Then you can check style.Enabled (or style.ReadOnly or ???) to see if you want to move there. If not then try the next cell until you find one where you want to move.


PV Prathima Venkobachar August 22, 2005 11:51 AM UTC

Can you give the syntax for this.. Thanks, Prathima


AD Administrator Syncfusion Team August 22, 2005 12:40 PM UTC

Here is a rough try at it. int col = cc.ColIndex + 1; GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(cc.RowIndex, col); while(!style.Enabled && col < e.TableControl.Model.ColCount) { col += 1; if(col <= e.TableControl.Model.ColCount) style = e.TableControl.GetTableViewStyleInfo(cc.RowIndex, col); } if(col <= e.TableControl.Model.ColCount) cc.MoveTo(e.RowIndex, col); e.Inner.handled = true;


PV Prathima Venkobachar September 20, 2005 08:28 AM UTC

Hi, This is in continuation of the following thread... --------------------------------- Using the FreezePainting did not help. We have added a new paremeter in the SourceListListChanged event that will allow you to conditionally have the grid ignore the Reset message. This change will be in the final 3.3 release. It is not in the release candidate though. ------------------------------------- We have upgraded to 3.3 version. I want to avoid repainting of the grid when we call dataTable.AcceptChanges(). I have used the ShouldIgnoreReset property of the sourcelist changed event. I would like to know..is it right what I have done..or is there any better way of doing this..? I am attaching the modified sample code. Pl run the main project. Thanks, Prathima


PV Prathima Venkobachar September 20, 2005 08:32 AM UTC



PV Prathima Venkobachar September 23, 2005 05:35 AM UTC

Hi, I am using SourceListChanged event. I am using ShouldIgnoreReset = true property to avoid repainting conditinally.But I am not able to see any differnce by using this. I feel still the grid is refreshed.I have attached the code. Is there any modification I have to do in my coding..? Please see the previous thread. I am using 3.3version. Thanks, Prathima

Loader.
Live Chat Icon For mobile
Up arrow icon