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.
Unfortunately, activation email could not send to your email. Please try again.

Various questions, grouping grid

Thread ID:

Created:

Updated:

Platform:

Replies:

27169 Apr 7,2005 06:05 AM Apr 7,2005 07:50 AM Windows Forms 1
loading
Tags: GridControl
Kjetil Kåresen
Asked On April 7, 2005 06:05 AM

- How can I let the user delete rows? The default toolbar of the grid doesn''t seem to have a delete button? - Is there an easy way to have the grid hide the columns that are used for the grouping? (These are the same in each group anyway.) - How can I implement expand all/collapse all groups. Your help is much appriciated.

Administrator [Syncfusion]
Replied On April 7, 2005 07:50 AM

1) You can handle the TableControlCurrentCellKeyDown and call GridRecord.Delete for each selected record. (Assumes you are using the TableOptions.AllowSelections = None and TableOptions.ListBoxSelectionMode set to somthing other than None.).
private void gridGroupingControl1_TableControlCurrentCellKeyDown(object sender, GridTableControlKeyEventArgs e)
{
	if(e.Inner.KeyCode == Keys.Delete)
	{
		int rowIndex = e.TableControl.CurrentCell.RowIndex;
		int colIndex = e.TableControl.CurrentCell.ColIndex;
		Console.WriteLine("del key");
		ArrayList a = new ArrayList();
		foreach(SelectedRecord rec in e.TableControl.Table.SelectedRecords)
		{
			a.Add(rec);
		}
		foreach(SelectedRecord rec in a)
		{
			rec.Record.Delete();
		}
		e.Inner.Handled = true;
		e.TableControl.CurrentCell.MoveTo(rowIndex, colIndex);
        }
}

2) One way you can do this is to listen to teh TableDescriptor.GroupdeColumnsChanging.
private void GroupedColumns_Changing(object sender, Syncfusion.Collections.ListPropertyChangedEventArgs e)
{
	if(e.Action == Syncfusion.Collections.ListPropertyChangedType.Insert)
	{
		SortColumnDescriptor desc = e.Item as SortColumnDescriptor;
		this.gridGroupingControl1.TableDescriptor.VisibleColumns.Remove(desc.Name);
	}
}
3) this.gridGroupingControl1.Table.CollapseAllRecords(); this.gridGroupingControl1.Table.CollapseAllGroups();

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;