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

knockoutjs checkbox 全选 #1

Open
Hareis opened this issue Jul 22, 2019 · 0 comments
Open

knockoutjs checkbox 全选 #1

Hareis opened this issue Jul 22, 2019 · 0 comments

Comments

@Hareis
Copy link
Owner

Hareis commented Jul 22, 2019

前两天在编写页面的过程中knockoutjs 做的checkbox全选碰到了些许的小难题
当时API中返回对象列表

[
 {
   "ID":1
 },
 {
   "ID":2
 }
]

绑定到页面上
做的全选列表循环出checkbox始终不能选中,找了很多地方,以为是响应式修改的问题。
多次测试下来 发现ID绑定到页面后,由Number变成String,
然后在处理list 中将ID变更为String 问题就解决了

还有全选按钮的处理 由于 change 事件和click 冲突,所以需要监听全选按钮的change 事件,然后执行后面一系列的流程
完!

@Hareis Hareis closed this as completed Jul 22, 2019
@Hareis Hareis reopened this Jul 22, 2019
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

1 participant