【问题标题】:How can I select text in Kendo Ui Grid如何在 Kendo Ui Grid 中选择文本
【发布时间】:2016-02-18 02:50:17
【问题描述】:

在这个剑道网格演示中:

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

我可以选择多行,但如何选择第一行中的文本“France”?

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

编辑 1: 像这样的:

但我无法使用鼠标选择该演示中的文本

【问题讨论】:

标签: kendo-ui kendo-grid


【解决方案1】:
     //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>

【讨论】:

  • 感谢您的回复,我其实是想用鼠标高亮单元格中的文字,而不是选择单元格本身。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-02-13
  • 2020-09-22
  • 1970-01-01
  • 2013-06-29
  • 2017-04-15
  • 1970-01-01
相关资源
最近更新 更多