0

我的页面中有两个剑道网格。其中之一绑定到 ASP.NET MVC 操作。启用多个部分。我想将选定的网格项目添加到我的第二个网格。

<div id="grid1"></div> -- This Grid holds Master Data
<div id="grid2"></div> -- This Grid should hold Selected items of Grid One

$("#grid1").kendoGrid({

    sortable: true,
    selectable: "multiple row",
    pageable: true,
    change: onchange  ,
    filterable: true,
    dataSource: {
        transport: {
            read: "/Home/getPeople",
            datatype: "json"
        },
        pageSize:10
    },
    columns: [
        { field: "Id", title: "Id", template: '<input id=\'#=Id#\' class="personId" type=\"checkbox\"/>' },
        { field:"FirstName", title:"First Name",sortable:true },
        { field:"MiddleName", title:"Middle Name", sortable:true },
        { field: "LastName", title: "LastName", sortable: true },
    ]
});

$("#grid2").kendoGrid({

    sortable: true,
    selectable: "multiple row",
    pageable: true,
    filterable: true,
    dataSource: { -- Here i need to bind it with the selected items of Grid1.

    },
    columns: [
        { field: "Id", title: "Id", template: '<input id=\'#=Id#\' class="personId" type=\"checkbox\"/>' },
        { field: "FirstName", title: "First Name", sortable: true },
        { field: "MiddleName", title: "Middle Name", sortable: true },
        { field: "LastName", title: "LastName", sortable: true },
    ]
});

function onchange() {   
    var text = "";
    var grid = this;                

    grid.select().each(function() {
        var dataItem = grid.dataItem($(this));
        text += "First Name is: " + dataItem.FirstName + "\n";

        alert(text);
    });



}   

    ----I am capturing onChange event to Alert it's value but could not firgure out how it can be added to Grid2 and how on Submit i can only POST items that exist in Grid

   </script>
4

0 回答 0