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

About formulas inside a Hierarchy grid.....

First off thank you for adding hierarchy support on your grid. This was the one feature that was keeping us from considering your grid for our next project. Now that you have it, I can now review your grid and see if it will meet our companies needs. I do have a few quick questions though.... Can use formulas inside a hierarchy grid??? Can you delete / add rows at diffrent levels??? If you can, how does this affect my formulas??? Do any of the included examples show this? Keep up the good work. Thank you for your time. Javier

1 Reply

AD Administrator Syncfusion Team January 10, 2003 03:31 AM

Right now there is no UI support for adding rows in nested levels. You would have provide an external button and then add the row manually in the external data source. With the 2.0 version (currently scheduled for release toward the end of February) we will have improved hierarchy support where each nested table can have its own Append row just like a stand-alone table. While formula cells can be used in a hierarchical grid, there is currently no special support features added to the hierarchical structure to manage them. So you would have to determine exactly how you want your formulas to behave as you add/delete rows, and code the functionality yourself. This would likely mean that you would have to use them as unbound columns added in the virtual manner shown with the CustomersVirt sample. Currently, this is doable, but depending upon what functionality you want, it can become complex very quickly. Here is a new QueryCellInfo handler for the Customers.cs file in that CustomersVirt sample that puts a formula in one of teh unbound columns that uses the values from the previous column in the formula.
public void QueryCellInfo(QueryColumnStyleEventArgs e)
{
	GridQueryCellInfoEventArgs ce = e.GridInfo;
	if (e.MappingName == "Unbound1")
	{
		//make value some number
		ce.Style.CellValue = e.State.Position;
		if (e.Level.LevelIndex == 0)
			ce.Style.BackColor = Color.Cyan;
		else
			ce.Style.BackColor = Color.Yellow;
	}
	else if (e.MappingName == "Unbound2")
	{
		//make it some formula...
		//cell is somethlike:  E12
		//using ColIndex to pick up the value from UnBound1 (could probably do this in a more robust way
		string cell = GridRangeInfo.GetAlphaLabel(ce.ColIndex-1) + GridRangeInfo.GetNumericLabel(ce.RowIndex);
		ce.Style.CellType = "FormulaCell";
		ce.Style.CellValue = string.Format("=1.2 * {0} + {0}", cell);
	}
}

Loader.
Live Chat Icon For mobile
Up arrow icon