0
votes

In this Kendo grid demo :

http://demos.telerik.com/aspnet-mvc/grid/selection

I can select mutil rows, but how can I select the text "France" in the first row?

The user probably will need to copy some of the values from the cell, but if I enable the row selection I can no longer select text from cell.

Edit 1: Something like this:

But I couldn't use mouse to select text in that demo

enter image description here

1
When multi-select is on, the mouse drag starts the multi-select operation instead of normal highlight. Apparently there is no built-in way to turn it off, so you have to implement your own workaround: telerik.com/forums/multiselect-grid-deactivate-mouse-selection. There's also this that may be useful: demos.telerik.com/aspnet-mvc/grid/copy-to-excel - The Dread Pirate Stephen

1 Answers

0
votes
     //Try this out - Kendo grid view
@(Html.Kendo().Grid<Models.ViewModel>()
        .Name("grid")
        .Columns(columns =>
        {
            columns.Bound(p => p.ProductName).Title("Product Name");
            columns.Bound(p => p.UnitPrice).Title("Price");
            columns.Bound(p => p.UnitsInStock).Title("Units");
        })
        .Pageable()
        .Sortable()
        .Selectable(selectable => selectable
            .Mode(GridSelectionMode.Multiple)
            .Type(GridSelectionType.Cell))
        .Events(events => events.Change("onChange"))
        .DataSource(dataSource => dataSource
            .Ajax()
            .Read(read => read.Action("ReadMethod", "Controller"))
         )
)

<script type="text/javascript">

    function onChange(arg) {
        //arg.sender has all model properties selected
        var selected = $.map(this.select(), function (item) {
            return $(item).text();
        });
        //Selected item will have all column properties selected
        alert("Selected: " + selected.length + " item(s), [" + selected.join(", ") + "]");
    }
</script>