Jquery 如何使剑道多重选择取决于剑道网格表中的另一个剑道下拉列表

Jquery 如何使剑道多重选择取决于剑道网格表中的另一个剑道下拉列表,jquery,kendo-ui,telerik,kendo-grid,kendo-asp.net-mvc,Jquery,Kendo Ui,Telerik,Kendo Grid,Kendo Asp.net Mvc,我已经看到了关于级联多选择的剑道示例,但这不在剑道网格中,如下图所示 .. 如果我们有一个剑道网格,它有两列,比如columnA(剑道下拉类型)和coulmnB(剑道多选类型)。现在columnA中第1行的更改正在影响第1行multiSelect columnB的数据源。 columnA中第2行的更改正在影响第2行multiSelect columnB的数据源 我可以做的是,我已经在kendo网格的数据源中声明了模型,如下所示 model: { id: "id",

我已经看到了关于级联多选择的剑道示例,但这不在剑道网格中,如下图所示
.. 如果我们有一个剑道网格,它有两列,比如columnA(剑道下拉类型)和coulmnB(剑道多选类型)。现在columnA中第1行的更改正在影响第1行multiSelect columnB的数据源。 columnA中第2行的更改正在影响第2行multiSelect columnB的数据源

我可以做的是,我已经在kendo网格的数据源中声明了模型,如下所示

model: {
        id: "id",
        fields: 
         {
            courseName: { defaultValue: {}  ,editable: true, validation: { required: true,required: { message: "Please Select a course" }} },// this will be kendoDropDownList

            students:  { type: "string",editable: true  }// this is will be kendoMultiSelect
                }
        }// end model
在网格中,我确实喜欢下面

 var grid=   $("#grid").kendoGrid({
                    dataSource: dataSource,
                    pageable: true,
                    columnMenu:true,
                    filterable:true,
                    height: 550,
                    reorderable: true,
                      columnReorder: function(e) {
                        console.log(e.column.field, e.newIndex, e.oldIndex);                                                              
                      },
                    toolbar: ["excel", { template: kendo.template($("#template").html()) } , { template: kendo.template($("#clearFilterTemplate").html()) },{template: kendo.template($("#searchTemplate").html())} ],
                    excel: {
                            fileName: "Export Table.xlsx",
                            proxyURL: "excelExport",
                            filterable: true,
                            allPages: true
                        },                        
                     editable: true,//   editable: "inline" editable: true,
                     resizable: true,
                     columns: [
                                 { field: "checkbox", title: "Box", width: 50,  template: "<input type='checkbox' name='checkbox' class='checkbox' />"  },  

                                  {
                                          field: "courseName",editor: courseEditor,title:"Course", width: 200

                                },
                                {
                                          field: "students",editor: studentsEditor,title:"Students", width: 200

                                }

                               // { command: ["edit"], title: "&nbsp;", width: "100px" }

                            ]


                });

 function courseEditor(container, options)
 {
  var selectedRowModel = options.model;


                                    var input = $('<input id="courseName" name="courseName">'); 

                                    // append to the editor container
                                    input.appendTo(container);

                                    // initialize a dropdownlist
                                    input.kendoDropDownList({
                                        dataTextField: "text",
                                        dataValueField: "value", 

                                       change: function (e) { },

                                        dataSource: {
                                        dataType: "json",                                 
                                        transport: {
                                            read: "getCourses"

                                                  }// end transport
                                           }// datasource
                                    }).appendTo(container);                                 

 }

 function studentsEditor(container, options)
 {

  $("<select multiple='multiple' data-bind='value :students'/>")
      .appendTo(container)
      .kendoMultiSelect({
      valuePrimitive: true,
      dataSource: studentInitialDataSource,
      dataTextField: "text",
      dataValueField: "value",
      //cascadeFrom: "courseName", // cascade from courseName dropdownlist
       change: function (e) { },
      open: function(e) {
            //var item = e.item;
            //var text = item.text();
            // Use the selected item or its text

             var selectedRowModel = options.model;
             var courseName= selectedRowModel.courseName;
             if( courseName== null )
             {
                alert("yes it is null the courseName");

             }
             else
             {
                alert("no it is not null see courseName:"+courseName);

                var newDataSource = new kendo.data.DataSource({
                    transport: {
                        read: {
                            url: "getStudents?courseName="+courseName,
                            dataType: "json"
                            /*data: {
                                q: function() {
                                    return $("#searchFor").val();
                                              }
                                    }*/
                        }
                    }
                });

                this.setDataSource(newDataSource );  
                //shecdulCycleDataSource = secondDataSource   ;

             }

          }
    });


 }
var grid=$(“#grid”).kendoGrid({
数据源:数据源,
pageable:对,
专栏菜单:是的,
可过滤:正确,
身高:550,
可重定额:对,
列重新排序:函数(e){
log(e.column.field,e.newIndex,e.oldIndex);
},
工具栏:[“excel”、{template:kendo.template($(“#template”).html())}、{template:kendo.template($(“#clearFilterTemplate”).html())}、{template:kendo.template($(“#searchTemplate”).html())},
卓越:{
文件名:“导出表.xlsx”,
proxyURL:“excelExport”,
可过滤:正确,
所有页面:正确
},                        
可编辑:true,//可编辑:“内联”可编辑:true,
可调整大小:正确,
栏目:[
{字段:“复选框”,标题:“框”,宽度:50,模板:},
{
字段:“courseName”,编辑:courseEditor,标题:“Course”,宽度:200
},
{
字段:“学生”,编辑:学生编辑,标题:“学生”,宽度:200
}
//{命令:[“编辑”],标题:,宽度:“100px”}
]
});
函数courseEditor(容器、选项)
{
var selectedRowModel=options.model;
变量输入=$('');
//附加到编辑器容器
输入。附加到(容器);
//初始化下拉列表
input.kendoDropDownList({
dataTextField:“文本”,
dataValueField:“值”,
更改:函数(e){},
数据源:{
数据类型:“json”,
运输:{
阅读:“getCourses”
}//末端运输
}//数据源
}).附在(容器)上;
}
函数studentsEditor(容器、选项)
{
$("")
.appendTo(容器)
.kendoMultiSelect({
对,,
数据源:studentInitialDataSource,
dataTextField:“文本”,
dataValueField:“值”,
//cascadeFrom:“courseName”//cascade from courseName dropdownlist
更改:函数(e){},
开放:功能(e){
//var项目=e项目;
//var text=item.text();
//使用所选项目或其文本
var selectedRowModel=options.model;
var courseName=selectedRowModel.courseName;
if(courseName==null)
{
警报(“是,课程名称为空”);
}
其他的
{
警报(“不,不为空,请参见courseName:+courseName”);
var newDataSource=new kendo.data.DataSource({
运输:{
阅读:{
url:“getStudents?courseName=“+courseName,
数据类型:“json”
/*数据:{
q:函数(){
返回$(“#searchFor”).val();
}
}*/
}
}
});
this.setDataSource(newDataSource);
//shecdulCycleDataSource=第二个数据源;
}
}
});
}
如果您在上面看到,我已经使用了这个.setDataSource(newDataSource);要更改kendoMultipleSelect的数据源,请在其打开时选择,但当课程值更改时,我需要的学生列表也会自动更改


如何做到这一点,任何例子都将不胜感激

如果可能的话,你能分享一下你的尝试吗?贾耶什·戈亚尼,谢谢你的回复,我已经更新了我所做的和尝试的,你能告诉我怎么做吗?贾耶什·戈亚尼,没有解决方案……如果可能,你能分享一下你的尝试吗?贾耶什·戈亚尼,谢谢你的回复,我已经更新了我所做的和尝试过的,你能告诉我怎么做吗?.Jayesh Goyani,没有解决方案。。。