Unplanned
Last Updated: 21 Jan 2020 08:12 by ADMIN
Ron
Created on: 25 Oct 2019 10:09
Category: Grid
Type: Feature Request
1
Property or setting to enable or disable the selection of the grid instead of having to code it yourself in ondatabound

add a grid to a view

open the view with data bound to the grid.

First line of data is not selected.

 

Now i have to program the ondatabound property for a function which belongs to the grid component. Make it configurable for grids which do not need this feature or vice versa.

3 comments
ADMIN
Alex Hajigeorgieva
Posted on: 11 Nov 2019 09:30

Hi, Ron,

From my experience, I believe that the requirement to select a row on load is not always the same - i.e. it is not always the first row that others want selected.

In my opinion, it would be more flexible to have a property that accepts a selector so that way if using multiple select, you could use it, too. What do you think about something like:

// single selection
GridBuilder.Selectable(selectable => selectable.Mode(GridSelectionMode.Single).SelectOnLoad("tr:eq(0)")

// OR
GridBuilder.Selectable(selectable => selectable.Mode(GridSelectionMode.Single).SelectOnLoad(".some-class-name")

// multiple selection
GridBuilder.Selectable(selectable => selectable.Mode(GridSelectionMode.Single).SelectOnLoad("tr:eq(0), tr:eq(3)")

Look forward to hearing back from you.

Kind Regards,
Alex Hajigeorgieva
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Ron
Posted on: 04 Nov 2019 11:13

I have something like this in mind:

 

GridBuilder.Selectable(selectable => selectable.Mode(GridSelectionMode.Single).SelectFirstRow(true)

 

I prefer this property to have a default value of true, so that it only needs to be set in case of the rare occasion that it needs to be false.

 

kind Regards,

Ron Baeten

senior developer

TNG Screen

ADMIN
Alex Hajigeorgieva
Posted on: 01 Nov 2019 08:36

Hi, Ron,

Dependent on the desired selection (cell or row), you can achieve that by adding the "k-state-selected" class to the column or to the row conditionally.

For the row, you can implement a ClientRowTemplate like this:

           .Columns(columns =>
           {
               columns.Bound(p => p.OrderID);
           })
            .ClientRowTemplate("<tr data-uid='#: uid #' class='#=OrderID %2 == 0 ? 'k-state-selected': ''#'>" +
                "<td class='details'> #: OrderID # </td>" +
                 "</tr>")

The cell configuration on the other hand would look like this:

columns.Bound(p => p.OrderID).HtmlAttributes(new { @class = "#=OrderID %2 == 0 ? 'k-state-selected': ''#"});

In case you had something else in mind, can you please advise how you imagine its implementation and functionality, for instance what would pseudo code for it look like?

Kind Regards,
Alex Hajigeorgieva
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.