This is a migrated thread and some comments may be shown as answers.

Select all the cells from a column

2 Answers 82 Views
DataGrid
This is a migrated thread and some comments may be shown as answers.
Stavros
Top achievements
Rank 1
Stavros asked on 05 Apr 2018, 07:46 AM

Hi, 

Is there any way to select and edit all the cells from a specific column?

Regards,

Stavros

 

2 Answers, 1 is accepted

Sort by
0
Stavros
Top achievements
Rank 1
answered on 05 Apr 2018, 07:49 AM
I mean from the code. I know the Name of one column and want to edit all the cells of it. 

**Sorry for the second post. I can't edit the first one.**
0
Lance | Manager Technical Support
Telerik team
answered on 05 Apr 2018, 02:42 PM
Hi Stavros,

It's not possible to select all the cells in a column with a single gesture (i.e. column header tap), However, if the DataGrid uses SelectionUnit=Cell and SelectionMode=Multiple, then you can programmatically select each cell in a loop. For more information, go to the DataGrid Selection documentation.

For your convenience, I'll highlight the relevant properties in the pasted informaiton below:
  • SelectionUnit property (type of DataGridSelectionUnit):
    •  - Row: The unit to select is a grid row(by default).
    •  - Cell: The unit to select is a cell within a grid row.

To define a Cell when using a selection you can use the DataGridCellInfo class, that holds all the information about it. To define a Row when using a selection you can use your data object.

  • SelectionMode property (type of DataGridSelectionMode):
    •  - Single: Single unit may be selected(by default).
    •  - Multiple: Multiple units may be selected.
    •  - None: No selection is allowed.
Editing

Additional functionalities for programmatic selecting and deselecting items are exposed by this component as methods. They also depend on the applied SelectionUnit.

  •  - SelectItem(object item): Selects the specified data item and adds it in the SelectedItems collection.
  •  - DeselectItem(object item): Removes the selection for the specified data item and removes it from the SelectedItems collection.
  •  - SelectCell(DataGridCellInfo item): Selects the grid cell as defined by the specified cell info.
  •  - DeselectCell(DataGridCellInfo item): Removes the selection for the grid cell defined by the specified cell info.
  •  - SelectAll(): Selects all the items as defined by the SelectionMode and SelectionUnit property.
  •  - DeselectAll(): Clears the current selected items as defined by the SelectionUnit property
As far as editing goes, you can change the underlying property value. Make sure you have PropertyChanged wired up or else the UI will not display the changes.

Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
DataGrid
Asked by
Stavros
Top achievements
Rank 1
Answers by
Stavros
Top achievements
Rank 1
Lance | Manager Technical Support
Telerik team
Share this question
or