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
close icon

Cell Selection

I need to have the ability to capture user cell selections and later on mark the grid with the selections.
I noticed you can add an event on cell selection, does it return the cells it selected? in what format?
To render the marking, I would assume I need to perform on the Grid PreRender event, what would be the best way to identify the cell?
Can I disable the charting associated with the cell selection, that would only confuse the user.

Thanks


3 Replies

MA Maheswari Syncfusion Team February 29, 2012 01:36 PM UTC

Hi Ray,

Thanks for your interest in Syncfusion Products.

Here is the response for your queries:

1) Capturing cell selections using CellSelection event in OlapGrid:
We would like to inform you that the CellSelection event in our OlapGrid returns all the selected valuecells information in the PivotCellDescriptorCollection and you can make use of it to render these values into the other grid/chart as per your requirement. Also, please ensure to set the EnableCellSelection in OlapGrid to true in prior to calling the CellSelection event.

2) Best way to identify the cell:

OlapGrid Prerender event gets called before the rendering happens. You can mark the selected cells into the another Grid within the CellSelection event itself, as we have drawn the chart using selected cells. We hereby inform you that we have an event called “QueryCellInfo” which has been used to get the entire information of each cell in the OlapGrid.
3) Can I disable the charting associated with the cell selection?
Yes you can disable the charting associated with the cell selection, since we have the chart as a seperate control in the application.

Kindly open an incident to gather more information relevant to this. Incident can be opened through Direct-Trac Developer Support System (<https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents>), were you can take advantage of the expertise of a dedicated support engineer and a guaranteed response time. Hope you will take advantage of this system as well. If you have already reported, please ignore this.

Thanks,
R.Maheswari.





RL Ray Lee March 1, 2012 06:34 PM UTC

Thanks for your response. I think you have answer most of my questions.

One thing I didn't make clear on the question is that, on the cell selection, I will need to know which exact cell(s) the user has selected. I will need to know, (using your example) the cell FY2002,H2FY2002,Q3FY2002,Jan2002,Jan1 2002 AND Australia,New South Wales,Coffs Harbour,2450,Adriana Smith is selected

OR

The selected cells are FY2002 AND Australia.
You mentioned that is a PivotCellDescriptorCollection, can I use that info to highlight those selected cells after the grid is refresh.

I would think I can store that info in a DB.

Thanks




MA Maheswari Syncfusion Team March 2, 2012 12:23 PM UTC

Hi Ray,

We would like to inform you that the information about the headers (row and column) for the selected cells in the OlapGrid can be obtained through the ‘PivotCellDescriptorCollection[i].CellData.Columns’ and ‘PivotCellDescriptorCollection[i].CellData.Rows’.

Please refer the below code snippet to get the Row and Column Headers (such as FY2002, Australia,..) in the List:

Code Snippet:

[C#]:
//Place this code outside the Page_Load event
List> list = new List>();

//Place this code within Page_Load event
this.OlapGrid1.EnableCellSelection = true;
this.OlapGrid1.CellSelection += new OlapGrid.RaiseCellSelectionMouseHandler(OlapGrid1_CellSelection);

//Place this code after Page_Load event
private void OlapGrid1_CellSelection(object sender, CellSelectionEventArg e)
{
for(int i=0;i {
list.Add(new KeyValuePair(e.PivotCellDescriptorCollection[i].CellData.Columns.ToString(),e.PivotCellDescriptorCollection[i].CellData.Rows.ToString()));
}

//QueryCellInfo event returns the information about each cell. Within this event, we can handle the operation to highlight the selected cells which are in the list.
this.OlapGrid1.QueryCellInfo += new EventHandler(OlapGrid1_QueryCellInfo);

}



We hereby inform you that we have an event called “QueryCellInfo” in the OlapGrid through which the each cell can be hooked with its information and using this event, we can perform the operation to change the particular grid cell styles.

Please find the below code snippet for QueryCellInfo event in which we applied the background color for the selected cells that are in the list:

[C#]:
protected void OlapGrid1_QueryCellInfo(object sender, CellInfoEventArgs e)
{
for (int i = 0; i < list.Count; i++)
{
if ((e.CellDescriptor.CellData.Columns.ToString().CompareTo(list[i].Key) == 0) && (e.CellDescriptor.CellData.Rows.ToString().CompareTo(list[i].Value) == 0))
e.Cell.BackColor = Color.Aqua;
}
}

We have prepared a simple sample with Olapgrid and its background color has been applied to the valuecells which are selected through cellselection.

Please have the sample and its screenshots from the following location:

http://www.syncfusion.com/downloads/Support/DirectTrac/General/Sample1497286804.zip

Please let us know if you have any concern.

Thanks,
R.Maheswari.







Loader.
Live Chat Icon For mobile
Up arrow icon