jqGrid在保存之前验证数据,然后按esc键确认之前 [英] jqGrid validate data before save when pessing enter key an confirm before esc

查看:76
本文介绍了jqGrid在保存之前验证数据,然后按esc键确认之前的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在网格中使用内联编辑,保存/编辑/取消/删除按钮是自定义的,对于保存之前需要调用的每一列,我都有几个验证功能,我正在制作一个将在行上按Enter键会被调用,但是即使在successfunc上返回false时,我似乎也无法阻止它保存.

I'm trying to use inline editing in a grid, save/edit/cancel/delete buttons are custom, I have several validation functions for every column that need to be called before saving, I'm making a function that will be called on pressing enter on the row, however I can't seem to be able to stop it from saving even tho I return false on successfunc.

$grid.editRow(id,{
    keys : true,
    successfunc : function(data){
        saveData(data);
        return [false,""];       
    }
});

PS:在每列上定义的编辑规则对我没有帮助,因为我希望仅在保存时调用我的验证

PS: editrules defined on each column won't help me because I want my validations to be called only on save

推荐答案

在这种情况下,我认为您的验证有点晚了.

I think you are a little to late in your validation in this case.

来自: http://www.trirand.com/jqgridwiki/doku.php?id = wiki:inline_editing

succesfunc:如果定义,则在请求成功后立即调用此函数.此函数传递从服务器返回的数据.取决于服务器中的数据;此函数应返回true或false.

succesfunc: if defined, this function is called immediately after the request is successful. This function is passed the data returned from the server. Depending on the data from server; this function should return true or false.

在进行保存之前,您是否正在进行验证?

Are you validating before you let the Save occur?

这篇关于jqGrid在保存之前验证数据,然后按esc键确认之前的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆