Javascript 从表初始化剑道UI网格--如何验证?

Javascript 从表初始化剑道UI网格--如何验证?,javascript,validation,kendo-ui,kendo-grid,Javascript,Validation,Kendo Ui,Kendo Grid,我正在测试剑道UI网格,在从现有表初始化网格时,我很难找到通过API验证更新的方法。 所有CRUD都按预期工作,在提交之前,我无法在客户端进行验证 在这种情况下,是否有一种内置的方法来进行验证? (这里的数据完全是任意的) 手指指向正确的方向是非常值得赞赏的 我的javascript: $('table.data-table').kendoGrid( { toolbar: ["create"], editable: 'popup',

我正在测试剑道UI网格,在从现有表初始化网格时,我很难找到通过API验证更新的方法。 所有CRUD都按预期工作,在提交之前,我无法在客户端进行验证

在这种情况下,是否有一种内置的方法来进行验证? (这里的数据完全是任意的)

手指指向正确的方向是非常值得赞赏的

我的javascript:

    $('table.data-table').kendoGrid(
    {
        toolbar: ["create"],
        editable: 'popup',
        sortable: true,
        pageable: { pageSize: 10, pageSizes: true },
        filterable: true,
        columnMenu: true,
        columns: [
            { field: "ID", title: "ID" },
            { field: "name", title: "Name" },
            { field: "capital", title: "Capital City" },
            { field: "largest_city", title: "Largest City" },
            { field: "population", title: "Population" },
            { command: ["edit", "destroy"], title: ' ' }
        ],
        save: myUpdateFunction,
        remove: myRemoveFunction
    });
我的html:

<table class="data-table">    
        <thead>
            <tr>
                <th>ID</th>
                <th>Name</th>
                <th>Capital</th>
                <th>Largest City</th>
                <th>Population</th>
                <th></th>
            </tr>
        </thead>
        <tbody>        
        <tr>
            <td>AK</td>
            <td>ALASKA</td>
            <td>Juneau</td>
            <td>Anchorage</td>
            <td>698473</td>
            <td></td>
        </tr>
         ....
         </tbody>
  </table>

身份证件
名称
首都
最大城市
人口
AK
阿拉斯加州
朱诺
安克雷奇
698473
....

事实上,这很容易。通过自定义编辑器模板,可以添加所需的属性。因此,在列中向编辑器属性添加函数名

    columns: [
        { field: "ID", title: "ID", editor: requiredField },
        { field: "name", title: "Name", editor: requiredField },
        { field: "capital", title: "Capital City" },
        { field: "largest_city", title: "Largest City" },
        { field: "population", title: "Population" },
        { command: ["edit", "destroy"], title: '&nbsp;' }
    ],
在函数内部,您可以根据需要格式化/自定义输入。在我的例子中,键只是添加必需的属性

function requiredField(container, options) {
    var theInput = '<input class="k-input k-textbox" name="' + options.field + '" required data-     bind="value: ' + options.field + '" />';
    $(theInput).appendTo(container);
}
函数所需字段(容器、选项){
变量输入=“”;
$(输入)。附加到(容器);
}