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

GridGroupingControl: How do I manually populate with data?

Hi, I have seen many examples where the GridGroupingControl is used with datasets populated from Xml and databases. However, is there a way to manually populate this control and manually define what I would like grouped? I am attempting to create something that would look like a treelist where each node has a corresponding Date. Currently I have got as far as putting top level data into a DataTable and adding a GroupedColumn but this does not show children. I believe it may the same problem as this thread: http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=29796 Please can you point me in the right direction to achieve this. Many thanks!

10 Replies

AD Administrator Syncfusion Team July 18, 2005 12:26 PM

If by manually populate the data, you mean to dynamically provide child information on demand as the child is expanded, currently this not possible in a GridGroupingControl. You can use datatstructures other tahn arraylists. Here is a little sample using nested arraylist datasources. http://www.syncfusion.com/Support/user/uploads/GGC_ArrayLists_a38ab2f8.zip


JL Jessy Liu July 19, 2005 04:28 AM

Hi Clay, Thanks for the sample. It seems to start to do the tree structure. However, it doesn''t show the child data. I''ve attached a screenshot of what I see when I run your sample. GGC_ArrayList_screenshot_9653.zip How do I view the child data itself? Thanks!


AD Administrator Syncfusion Team July 19, 2005 05:14 AM

What version of our libraries are you using? I tried the C# sample in 3.2.1.0 (3.201.1.0) and did not see this problem. Your picture suggests that the child list was empty. If you need to support empty lists, then you should derive ArrayList and have the derived class implement ITypedList. Here is a forum link with a sample. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=30556


JL Jessy Liu July 19, 2005 05:36 AM

The list isn''t empty - it shows the correct number of rows according to how many children there are but it shows them as that other data you see in the screenshot. I think I am on version 2.1.0.9. Is there a solution for this version? Thanks.


AD Administrator Syncfusion Team July 19, 2005 05:51 AM

Did you try having the list implement ITypedList? http://www.syncfusion.com/Support/user/uploads/GGC_ArrayLists_9448350b.zip


JL Jessy Liu July 19, 2005 06:39 AM

Hi Clay, That worked a treat - thanks! Now 4 minor things I haven''t managed to find. 1. On the GridGroupingControl I can do: _ggc.TableModel.Properties.DisplayHorzLines = false; _ggc.TableModel.Properties.DisplayVertLines = false; However, this only does the top level and does not propogate down to the children. I could not find a corresponding TableModel in the relations. Could you tell me where I can set this for the relations? 2. I have two columns - name and date. No matter what I call them, it always shows the date in the first column and the name in the second. Is there a way to define which way round the columns should go? This will need to apply to all levels / relations. 3. I would like the format of the date column to be YYYYMMDD hh:mm:ss but cannot see where I can set this. 4. Some items do not have any children but they still display the +/-. Is there a way to remove this? Additionally, is there a way to change the look of the +/- button? Thanks for all your help!


AD Administrator Syncfusion Team July 19, 2005 06:58 AM

1) You can use this.gridGroupingControl1.GetTableModel and this.gridGroupingControl1.GetTableControl to get the child tables. 2) You can explicitly add the columns to the TabelDescriptor.VisibleCOlumn collection to control the order. Or, in the ITypedList.GetProperties method, you can change order of the property descriptors in the returned collection. 3) TableDescriptor.Columns[name].Appearance.AnyRecordFieldCell.Format = "YYYMMDD"; 4) To hide the plus/minus, see http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=30438 To draw something else, you can try using the TableControlDrawCellButton and draw what you want.
private void gridGroupingControl1_TableControlDrawCellButton(object sender, GridTableControlDrawCellButtonEventArgs e)
{
	GridTableCellStyleInfo style = e.Inner.Style as GridTableCellStyleInfo;;
	if(style.TableCellIdentity.TableCellType == GridTableCellType.RecordPlusMinusCell
		||style.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionPlusMinusCell)
	{
		ControlPaint.DrawButton(e.Inner.Graphics, e.Inner.Button.Bounds, ButtonState.Normal);
		e.Inner.Cancel = true;
	}
}


JL Jessy Liu July 19, 2005 09:02 AM

Hi Clay, Worked brilliantly thanks. Almost there... The final thing I would like to do is remove the part on the left that shows you which row you are in. Is this possible?


AD Administrator Syncfusion Team July 19, 2005 10:34 AM

Try this.gridGroupingControl1.TableOptions.ShowRowHeader = false;


JL Jessy Liu July 20, 2005 03:47 AM

Brilliant. Thanks for all your help, Clay!

Loader.
Live Chat Icon For mobile
Up arrow icon