Skip to content

docs(treelist): Add Cell Selection documentation and revamp Selection… #2302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 2, 2024

Conversation

NansiYancheva
Copy link
Contributor

@NansiYancheva NansiYancheva self-assigned this Aug 2, 2024
@NansiYancheva NansiYancheva requested a review from a team as a code owner August 2, 2024 18:02
@dimodi dimodi merged commit 60426ae into master Aug 2, 2024
1 check passed
@github-actions github-actions bot deleted the docs-cell-selection-treelist-new branch August 2, 2024 18:39
Copy link
Contributor

@ikoevska ikoevska left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed. Note that there are some typos that need to be fixed.

@@ -1,7 +1,7 @@
---
title: Cell Selection
page_title: Grid - Cells Selection
description: Learn how to select cell in Blazor Grid component. Explore the selected cells. Discover cell selection bevahior when combined with other Grid features. Try the practical sample code for cell selection.
description: Learn how to select cell in Blazor Grid component. Explore the selected cells. Discover cell selection bevahior when combined with other Grid features. Try the practical sample code for cell selection.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: Learn how to select cell in Blazor Grid component. Explore the selected cells. Discover cell selection bevahior when combined with other Grid features. Try the practical sample code for cell selection.
Learn how to select cells in the Blazor Grid component. Explore the selected cells. Discover how cell selection behaves when combined with other Grid features. Try the practical sample code for cell selection.

---
title: Cell Selection
page_title: TreeList - Cells Selection
description: Learn how to select cell in Blazor TreeList component. Explore the selected cells. Discover cell selection bevahior when combined with other TreeList features. Try the practical sample code for cell selection.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: Learn how to select cell in Blazor TreeList component. Explore the selected cells. Discover cell selection bevahior when combined with other TreeList features. Try the practical sample code for cell selection.
description: Learn how to select cells in the Blazor TreeList component. Explore the selected cells. Discover how cell selection behaves when combined with other TreeList features. Try the practical sample code for cell selection.


# Cell Selection

The TreeList component supports [single or multiple cell selection]({%slug treelist-selection-overview%}#use-single-or-multiple-selection). You can select a cell with mouse click anywhere in the cell. You can access the collection of selected cells, use this collection and manipulate it. You can subscribe to selection events.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Provides fits better here as it's more of an active statement, suggesting value, rather than the more passive "supports". Our style guide also recommends the serial comma for a list of three or more items.

Suggested change
The TreeList component supports [single or multiple cell selection]({%slug treelist-selection-overview%}#use-single-or-multiple-selection). You can select a cell with mouse click anywhere in the cell. You can access the collection of selected cells, use this collection and manipulate it. You can subscribe to selection events.
The TreeList component provides [single and multiple cell selection]({%slug treelist-selection-overview%}#use-single-or-multiple-selection). You can select a cell with mouse click anywhere inside the cell. You can access the collection of selected cells, use this collection, and manipulate it. You can subscribe to selection events.


To select a cell, click anywhere in it.

To select a range of cells in one or more columns, hold the **Shift** key, while clicking on the first and last cell of the range. To select or deselect multiple cells that don't belong to a range, hold the **Ctrl** key.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally, our style guide suggests monospace formatting for key names. Source.

When the TreeList `Data` collection changes, the `SelectedCells` collection has the following behavior:

* When the user updates a selected cell and the item instance is replaced, you have to also replace the `DataItem` object in the `SelectedCells` collection. Do that in the [TreeList `OnUpdate` event]({%slug treelist-editing-overview%}#events).
* When the user deletes a row with selected cells, update the `SelectedCells` collection in the the TreeList `OnDelete` event handler.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* When the user deletes a row with selected cells, update the `SelectedCells` collection in the the TreeList `OnDelete` event handler.
* When the user deletes a row with selected cells, update the `SelectedCells` collection in the TreeList `OnDelete` event handler.

---
title: Row Selection
page_title: TreeList - Rows Selection
description: Learn how to select row in Blazor TreeList component. Explore the selected rows. Discover row selection bevahior when combined with other TreeList features. Try the practical sample code for row selection.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: Learn how to select row in Blazor TreeList component. Explore the selected rows. Discover row selection bevahior when combined with other TreeList features. Try the practical sample code for row selection.
description: Learn how to select rows in the Blazor TreeList component. Explore the selected rows. Discover how row selection behaves when combined with other TreeList features. Try the practical sample code for row selection.


# Row Selection

The TreeList component supports [single or multiple row selection]({%slug treelist-selection-overview%}#use-single-or-multiple-selection). You can select a row with mouse click and through a checkbox column. You can access the collection of selected rows, use this collection and modify it. You can subscribe to selection events.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The TreeList component supports [single or multiple row selection]({%slug treelist-selection-overview%}#use-single-or-multiple-selection). You can select a row with mouse click and through a checkbox column. You can access the collection of selected rows, use this collection and modify it. You can subscribe to selection events.
The TreeList component provides [single and multiple row selection]({%slug treelist-selection-overview%}#use-single-or-multiple-selection). You can select a row with mouse click and through a checkbox column. You can access the collection of selected rows, use this collection, and modify it. You can subscribe to selection events.


The items in `SelectedItems` are compared against the items in the TreeList data in order to determine which rows will be highlighted. The default framework behavior is to compare objects by reference. The data item references may not match when:

* The `SelectedItems` are obtained from a different data source than the all TreeList items, for example, from a separate service.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* The `SelectedItems` are obtained from a different data source than the all TreeList items, for example, from a separate service.
* The `SelectedItems` are obtained from a different data source than all the TreeList items, for example, from a separate service.


## Row Selection and Other TreeList Features

The selection behavior may vary when other TreeList features are enabled, such as editing, virtualization, paging, column and row templates, row drag and drop. In such cases you need to consider certain limitations or adjust the application code.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drag-and-drop

* If you are using a [TreeList column template]({%slug treelist-templates-column%}) and you have a clickable element in the template, you can check the knowledge base article on [how to prevent row selection when the user clicks another component in the Grid column template]({%slug grid-kb-row-selection-in-column-template%}). It is for the Grid component, but the concept is identical.
* If you are using a [row template]({%slug treelist-templates-row%}) the TreeList cannot render a built-in [checkbox column]({%slug treelist-columns-checkbox%}). You have to render checkboxes manually and handle their changed event to populate the `SelectedItems` collection of the TreeList. You can find an example to get started in the following thread: [Grid Row Template with Selection - Unsure how to Bind to Selected Item](https://feedback.telerik.com/blazor/1463819-grid-row-template-with-selection-unsure-how-to-bind-to-selected-item). It is for the Grid component, but the concept is identical.

### Selection and Row Drag and Drop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drag-and-Drop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants