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

Grid Selection

1 Answer 462 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Gert
Top achievements
Rank 1
Gert asked on 06 May 2019, 06:19 AM

Dear Telerik,

Is it possible to select a row ? Visually and logically ?
I need a modal choose-dialog -> Window with a grid where I can select an item and pass the selected object to the main Page.

 

Is it already possible ?

 

Regards,

Gert

1 Answer, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 06 May 2019, 10:42 AM
Hi Gert,

I made the following page for tracking this feature: https://feedback.telerik.com/blazor/1407775-grid-row-selection. I expect you already know the drill - but just in case - use the Follow button to get notifications.

On implementing this right now - I can see a way of implementing it at the moment like this:

  1. Add a command column to the dialog grid: https://docs.telerik.com/blazor-ui/components/grid/columns/command.
  2. In the click handler of the custom command, get the item the user chose and store it somewhere (for example, in a List that you have prepared for the purpose).
  3. You can consume this list on the main page (for example, bind another grid to it, or whatever else you need). You can also use it to populate a second grid (or a simpler list) in the dialog to show the selection to the user. At the moment, selection of rows is not available in the grid, so you couldn't easily make the appearance change.
    • Perhaps you could use a row/cell template and use a flag inside the model to add/remove a class that changes the appearance of all cells or a certain cell in the template. The issue with this approach is that the data model would need to learn about the presentation.
  4. Consider closing the dialog when the user selects and item (of course, suitable only if you want single row selection).

 


Regards,
Marin Bratanov
Progress TelerikUI for Blazor
Tags
General Discussions
Asked by
Gert
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or