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

Get the highlighted cells information

Hi,

We currently building a sfdatagrid control and would like to get the highlighted/ selected cells information. 
Now only able to get the last highlighted/selected cell information with the code below:
var cellInfos = SFDataGrid.SelectionController.CurrentCellManager.CurrentCell;

Any way to get the all highlighted cells information for example row and column index to retrieve the real data of the all highlighted cells?

Please advise, thanks.

3 Replies

FP Farjana Parveen Ayubb Syncfusion Team October 9, 2014 12:11 PM UTC

Hi Chong,

 

Thank you for contacting Syncfusion Support.

 

We have analyzed your query. You can achieve your requirement by using GetSelectedCells() method in SfDataGrid. By using this method you can get the whole selected cell information.

 

Please refer the below code snippet and sample in the following location:

 

Code Snippet:

 

  private void Button_Click(object sender, RoutedEventArgs e)

        {

           int rowindex =0;

           var selectedcels = this.sfdatagrid.GetSelectedCells();

           int count = selectedcels.Count;

           for (int i = 0; i < count; i++)

           {

               rowindex = this.sfdatagrid.ResolveToRowIndex(selectedcels[i].RowData);

               var colindex = this.sfdatagrid.Columns.IndexOf(selectedcels[i].Column);

               var visibilecolindex = this.sfdatagrid.ResolveToGridVisibleColumnIndex(colindex);

           }

        }

 

Regards,

Farjana Parveen A

 


Attachment: SfDataGridSelectedItems_cf40aebd.zip


CY Chong Yee Mei October 10, 2014 02:13 AM UTC

Hi,
The solution is useful, but now have another problems.
By using the sample when I select two items of CustomerBranch and two items of SalesId,
then the other unselected items of CustomerBranch gone.
Any way to solve it?
Please advise, thanks


Attachment: filterSelected_3b958241.zip


FP Farjana Parveen Ayubb Syncfusion Team October 10, 2014 09:28 AM UTC

Hi Chong,

 

Sorry about the inconvenience caused.

 

We have analyzed your query. Normally the filter pop up shows both checked and unchecked data on last filtered column where the filter has been applied and the remaining column shows only the visible data as checked state in filter pop up. It’s a behavior of filter in SfDataGrid.

 

Regards,             

Farjana Parveen A  


Loader.
Live Chat Icon For mobile
Up arrow icon