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

Grouping Grid and Threading

I am using the Essential Suite 2.0.2.1 latest beta and I have an application that is set up with a TreeView on the right and a GridGroupingControl on the right. When you click on a node in the TreeView I call a method with a switch statement that sets the columns, sorting, and grouping of the GridGroupingControl. This works find except for the fact that my dataset is about 22MB so it takes forever to load. My solution was to load two datasets. The first is a smaller subset of the full dataset. I load the sub dataset with the application thread then launch a new thread to load the full dataset in the background. When it is complete I which Tree views to display a complete list and set the DataSource/Datamember parameters of the new GridGroupingControl to that of the newly created dataset. At first this works great. The application launches in 15 or so secs and a subset of the views are populated. When the background thread is complete the TreeView changes and I get several new nodes. When I click on the one of the new nodes which uses the new GridGroupingControl I get the following error. All objects are created with the main application thread. All the background thread does is a fullDS.ReadXml("ViewDS.xml"); this.tableControl3.DataSource = db.fullDS; this.tableControl3.DataMember = "OPPSVIEW"; this.tvViewList.Visible = false; this.tvViewListFull.Visible = true; This is completed fine and I can pause the debugger and see the tables in the dataset after they load, but when I try and use them with the application thread it errors. I know the solution has to deal with InvokeRequired, BeginInvoke, and delegates, but I am not familiar with delegates and I am not sure how to apply them here. I have a method with the following signature: private void buildView(ref GridGroupingControl tableControl, string tableName, String [,] columns, Array grouped, Array sorted, String [,] filters, FilterCompareOperator[] condition) I have crated a delegate: delegate void buildViewDelegate(ref GridGroupingControl tableControl, string tableName, String [,] columns, Array grouped, Array sorted, String [,] filters, FilterCompareOperator[] condition); And modified the buildView method to include this if at the beginning if(tableControl.InvokeRequired) { buildViewDelegate bvd = new buildViewDelegate(buildView); tableControl.BeginInvoke(bvd, new object[] {tableControl, tableName, columns, grouped, sorted, filters, condition}); } else {... Now when I run this code tableControl.InvokeRequired is always false. I then tried to set InvokeRequired to true for the GridGroupingControl that uses the dataset that was loaded by the background thread, but that property is readonly. Any thoughts? Does my error message ring any bells? Am I applying delegates incorrectly? Syncfusion Grouping Gird Threading_9642.zip Syncfusion Grouping Gird Threading_2073.zip

Loader.
Live Chat Icon For mobile
Up arrow icon