如何在Kendo Ui Grid中选择文本

时间:2016-02-18 02:50:17

标签: kendo-ui kendo-grid

在这个Kendo网格演示中:

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

我可以选择mutil行,但是如何选择文本" France"在第一行?

用户可能需要从单元格中复制一些值,但如果我启用行选择,则无法再从单元格中选择文本。

编辑1: 像这样:

但我无法使用鼠标在该演示中选择文字

enter image description here

1 个答案:

答案 0 :(得分:0)

     //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"))
         )
)

&#13;
&#13;
<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>
&#13;
&#13;
&#13;