0

当失去焦点时,我会尝试检查表列值。
我做了一个演示来展示,便于理解。
这是链接。http://jsbin.com/oqeral/16/edit
在这里我尝试检查列值是否为真然后网格刷新或其他任何内容。
但是当它为假时,我想将焦点设置在最后一个焦点输出字段上。
这是简单的jquery。我在编辑时间剑道网格。

edit: function(e)
                {   
                   $('table').find('tr').mouseover( function(){
                     var row = $(this).find('td:eq(1)');
                     var box = $(row).find('input');
                     $(box).focusout(function(e){
                     if($(box).val() == 'Hood')
                     {
                       alert('Its Hood');
                     }
                       else
                       {
                         alert('Not Hood');
                       }
                     });
                   });
                }   

这是警报值Hood,然后从 Hood 列失去焦点。
但是如果Not Hood然后再次关注联合国引擎盖专栏。
我怎样才能做到这一点。在剑道网格中。
谢谢。

4

1 回答 1

1

您应该使用“保存”事件。

http://docs.kendoui.c​​om/api/web/grid#events-save

所以在你的情况下

var t = $("#grid").kendoGrid({
     dataSource: {
         data: users,
         pageSize: 10
     },
     pageable: true,
     selectable: "multiple row",
     toolbar: ["create"],
     columns: [{
         field: "UserId"
     }, {
         field: "UserName"
     }, {
         field: "IsAdmin"
     }, {
         command: "destroy",
         title: " ",
         width: "100px"
     }],
     editable: true,
     save: function (e) {

       // here you have the name before edit
       console.log('Name was: '+e.model.UserName);
       // with e.values you have the new values the user gave
       console.log('New name: '+e.values.UserName);

       // if the user has not given 'Hood' as a name for example...
       if(e.values.UserName!=='Hood'){
         // make your check and if you want to prevent saving you can do this for example
         e.preventDefault();
       }
     }
 });
于 2013-08-01T07:23:06.627 回答