Kendo Grid Inline下拉列表无法正常工作

时间:2017-04-18 20:10:49

标签: jquery kendo-ui kendo-grid

我使用了剑道网格,当我从下拉菜单中更改某个值时,它不会将其保存在行中。单击它后,它会立即恢复为相同的值。

$(function () {
    $("#grid").kendoGrid({
        pageable: true,
        height: 550,
        resizable: true,
        toolbar: ["create"],
        columns: [
            { field: "checkBox", filterable: false, title: "<input type=\'checkbox\' class='selectAll' />", width: "35px", template: "<input type=\'checkbox\' class=\'selectAll\' />" },
            { field: "index", filterable: true, title: "#", width: "35px" },
            { field: "Priority", editor: categoryDropDownEditor,  filterable: true, title: "Priority Two", width: "120px" },
        ],
        editable: true,
        })
    });

function categoryDropDownEditor(container, options) {
    $("<input data-bind='field:Priority' />")
        .appendTo(container)
        .kendoDropDownList({
            dataSource: [
                { title: "Yes" },
                { title: "No" }
            ],
            dataTextField: "title",
            dataValueField: "title",
        });
}

我只想使用是/否下拉菜单。当我单击该字段时,值就在那里,但是当我选择是或否时,没有任何内容输入到网格中。不知道为什么这不起作用。

1 个答案:

答案 0 :(得分:1)

您可以在Sub SplitWB() Application.EnableEvents = False: Application.ScreenUpdating = False: Application.DisplayAlerts = True On Error GoTo Cleanup Dim ws As Worksheet, wb As Workbook, team For Each team In getTeams Set wb = Workbooks.Add ' create a wb for each team with same # of sheets Do Until wb.Worksheets.count >= ThisWorkbook.Worksheets.count wb.Worksheets.Add After:=wb.Sheets(wb.Sheets.count) Loop For Each ws In ThisWorkbook.Worksheets With ws.UsedRange .AutoFilter 1, team ' filter to copy only the team's rows .Copy wb.Sheets(ws.Index).Range("A1") .AutoFilter End With wb.Sheets(ws.Index).name = ws.name & "_" & team Next wb.SaveAs ThisWorkbook.path & "\" & team & ".xlsx" wb.Close False Next Cleanup: Application.EnableEvents = True: Application.ScreenUpdating = True: Application.DisplayAlerts = True End Sub Function getTeams() ' gets the unique team names using a dictionary Dim cel As Range, dict As Object Set dict = CreateObject("Scripting.Dictionary") With ThisWorkbook.Sheets("Sheet1") For Each cel In .Range("A2:A" & .Cells(.Rows.count, "A").End(xlUp).row) If Len(Trim(cel.Value2)) > 0 Then dict(cel.Value2) = 0 Next End With getTeams = dict.Keys End Function

中设置valuePrimitive

检查jsFiddle。希望这对你有用。