剑道网格出错 - grid.select不是一个函数么?

时间:2016-11-05 11:17:55

标签: javascript jquery-ui kendo-ui kendo-grid kendo-asp.net-mvc

我有一个kendoDropDown列表作为我网格中的一个单元格。我使用kendo grid的编辑器命令调用kendDropDownList(" editor")。我需要将所选行的选定值传递给kendoDropDownList作为参数,以便服务器仅使用筛选列表作为我的kendoDropDownList回复。请参阅下面的示例

                         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: ["create","excel","save", "cancel" , { template: kendo.template($("#template").html()) } , { template: kendo.template($("#clearFilterTemplate").html()) } , { name: "create", text: "Add New Employee" }],
                    excel: {
                            fileName: "Kendo UI Grid Export.xlsx",
                            proxyURL: "excelExport",
                            filterable: true,
                            allPages: true
                        },                        
                     editable: "inline" , //editable: true,
                     columns: [
                                { field: "fileNo" , title:"File No" , width: 80 },
                                { field: "jobNo" , title:"Job No" , width: 80 },
                                { field: "discipline" , title:"Discipline" , width: 80 },
                                { field: "moduleNo" ,title:"Module", width: 100},
                                { field: "description",title:"Title",editor: descriptionDropDownEditor, width: 150},
                                { field: "documentNo",title:"Document No", width: 150 },
                                { field: "remarks",title:"Remarks" , width: 150 } ,
                                { command: ["edit","destroy"], title: " ", width: "250px" }

                            ]


                });


                function descriptionDropDownEditor(container, options) {

                 // here is the error grid.select is not a function why ?
                 var selectedItem = grid.dataItem(grid.select());
                 var selectedJobNo = selectedItem.jobNo ;
                 alert("selectedJobNo :"+selectedJobNo  );


                $('<input required name="' + options.field + '"/>')
                    .appendTo(container)
                    .kendoDropDownList({
                        autoBind: false,
                        dataTextField: "text",
                        dataValueField: "value",
                        filter: "contains",
                        dataSource: {
                            dataType: "json",                                 
                            transport: {
                                // I need to pass the selected jobNo in order to get the only aprropriate descrption for that jobNo
                                // each row job has description and I don't want to show all the description for all jobs , I need only for that row jobNo

                                 read: "getDescriptionForEachDocumentIndex?selectedJobNo"+selectedJobNo 
                            }
                        }
                          });
                }

一旦处于编辑模式的网格行,我需要将所选行jobNo传递给kendoDropDownList,以便仅回复该jobNo的相关描述。问题是我无法在编辑模式下调用网格并使用grid.select()函数。在这种情况下该怎么办?

0 个答案:

没有答案