Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

数据即时编辑 - checkbox 更新不了的问题 #84

Closed
fxiao opened this issue Nov 19, 2013 · 1 comment
Closed

数据即时编辑 - checkbox 更新不了的问题 #84

fxiao opened this issue Nov 19, 2013 · 1 comment

Comments

@fxiao
Copy link
Contributor

fxiao commented Nov 19, 2013

环境

  • 系统:MAC OS X 10.9
  • django-xadmin:0.4.0 ~ 0.4.2
  • 浏览器:Safari v7.0 (9537.71)/Firefox v25.0.1

重现操作流程

  1. BooleanField 字段使用 数据即时编辑
  2. 编辑,更新不成功1

debug

  • xadmin.plugin.editable.js:159 - $(this).attr('checked') 的值是 checkedundefined

解决

考虑到可能在 windows 下的浏览器不会出现这个问题。使用一种更通用的写法:$(this).is(':checked')

修改前:

this.$form.find('input[type=checkbox]').each(function(){
  if(!$(this).attr('checked')){
    off_check_box[$(this).attr('name')] = ''
  }
})

修改后:

this.$form.find('input[type=checkbox]').each(function(){
  if(!$(this).is(':checked')){
    off_check_box[$(this).attr('name')] = ''
  }
})
@sshwsfc
Copy link
Owner

sshwsfc commented Nov 20, 2013

你好,多谢你指出这个问题。能否帮忙提交pull request,这样xadmin的代码中就有你的一份了。

sshwsfc added a commit that referenced this issue Nov 20, 2013
[fixes #84] Checkbox is not real-time editing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants