duanou9739 2012-02-03 15:12
浏览 39

Kendo网格行选择

How can i get the Row ID by clicking on it? Actually I want to assign the remote table's row ID to each row of the Grid and by clicking on it, I want to load the second grid. Any solution?

  • 写回答

2条回答 默认 最新

  • dongtang6681 2012-02-10 08:13
    关注

    Here you go http://jsfiddle.net/qvKRk/

    JavaScript

    var dataSample = [];
    dataSample.push({
        OrderID: "1",
        ShipName: "line 1"
    });
    dataSample.push({
        OrderID: "2",
        ShipName: "line 2"
    });
    dataSample.push({
        OrderID: "3",
        ShipName: "line 3"
    });
    
    var dataSource = new kendo.data.DataSource({
        data: dataSample,
        schema: {
            model: {
                id: "OrderID"
            }
        },
        pageSize: 10
    });
    
    $("#grid").kendoGrid({
        dataSource: dataSource,
        selectable: true,
        columns: ["OrderID", "ShipName"],
        change: function () {
            var row = this.select();
            var id = row.data("id");
            $("#log").html("selected row with id= " + id);
            // sample selecting same row on second grid 
            // based on this post
            var secondGrid = $("#grid2").data("kendoGrid");
            var row = secondGrid.table.find('tr[data-id="' + id + '"]');
            secondGrid.select(row);
        }
    });
    
    $("#grid2").kendoGrid({
        dataSource: dataSource,
        selectable: true,
        columns: ["OrderID", "ShipName"]
    });
    

    HTML

    master grid :
    <br />
    <div id="grid"></div>
    <div id="log"></div>child grid :
    <br />
    <div id="grid2"></div>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:有没有什么其他办法能够保证不退出进程(相关搜索:matlab调用)
  • ¥15 依据报错在原代吗格式的基础上解决问题
  • ¥15 在虚拟机中安装flash code
  • ¥15 单片机stm32f10x编写光敏电阻调节3.3伏大功率灯亮度(光强越大灯越暗,白天正常光强灯不亮,使用ADC,PWM等模块)望各位找一下错误或者提供一个可实现功能的代码
  • ¥20 verilog状态机方法流水灯
  • ¥15 pandas代码实现不了意图
  • ¥15 GD32H7 从存储器到外设SPI传输数据无法重复启用DMA
  • ¥25 LT码在高斯信道下的误码率仿真
  • ¥45 渲染完成之后将物体的材质贴图改变,自动化进行这个操作
  • ¥15 yolov5目标检测并显示目标出现的时间或视频帧