jQuery JEditable在出错时停留在编辑模式下 [英] JQuery JEditable stay in edit mode on error

查看:101
本文介绍了jQuery JEditable在出错时停留在编辑模式下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已成功使用jeditable通过使用的功能提交 jQuery.ajax和async:false选项,但是有问题 如果返回错误,则中止操作.

I'm successfully using jeditable to submit via a function using jQuery.ajax and the async : false option , but am having an issue aborting if an error is returned.

如何使编辑框保持激活状态和/或恢复为 原始值是否有错误?我正在返回http状态 代码.

How can I get the edit box to stay activated and / or revert back to the original value if there are errors? I'm returning http status codes.

类似

async : false .ajax submit here...
if (xhr.status == 200) {
  return value;
else {
  alert ('returned error');
  // keep edit box activated but available for another try, or revert back to original value
}

我尝试不从该函数返回值,以保持编辑状态 框已激活,可以再次提交,然后按ESC键 不再起作用,如果我在编辑区域之外单击,则编辑 盒子保持住.

I tried not returning a value from the function, which keeps the edit box activated and ready for another submit, but then the ESC key doesn't work anymore and if I click outside the edit area, the edit box stays.

提前谢谢!

推荐答案

不确定这是否对您有帮助,但是jeditable中有一个reset方法...

Not sure if this helps in your situation, but jeditable has a reset method in it...

尝试...

this.reset();

this.reset();

这会将元素恢复为具有原始值的显示模式.

this will revert the element back to display mode with the original value.

这篇关于jQuery JEditable在出错时停留在编辑模式下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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