在淘汰表中使用选中的绑定和复选框列表会检查所有复选框 [英] Using the checked binding in knockout with a list of checkboxes checks all the checkboxes

查看:66
本文介绍了在淘汰表中使用选中的绑定和复选框列表会检查所有复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在绑定复杂值列表(id/ 说明)到复选框列表.

I have a problem when binding a list of complex values (id/ description) to a list of checkboxes.

问题是我不仅需要ID或说明,还需要 两者.

The problem is that I need not just the id or the description, but both.

当我使用Checked绑定进行绑定时,列表中的所有复选框 当我单击一项时被选中.

When I bind using the Checked binding, all the checkboxes in my list are checked when I click one item.

这是更大物体的一部分,也是我想要该物体和 不仅ID是复杂类型,反过来还会有一个列表 我想绑定到另一个复选框列表.

This is part of something bigger, and the reason I want the object and not just the id is that the complex type in turn will have a list which I want to bind to another list of checkboxes.

这里是一个产生问题的小提琴: http://jsfiddle.net/M8KFd/1

Here is a fiddle that produces the problem: http://jsfiddle.net/M8KFd/1

感谢您的帮助.

推荐答案

我分别跟踪每个项目的状态,然后使用

I track the state of each item individually, then get the selected items using a dependent observable something like this

这篇关于在淘汰表中使用选中的绑定和复选框列表会检查所有复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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