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

Various questions, grouping grid

- 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.

1 Reply

AD Administrator Syncfusion Team April 7, 2005 06: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();

Loader.
Live Chat Icon For mobile
Up arrow icon