淘汰赛 - 使用foreach将检查复选框带到列表之上
<div data-bind="foreach: lists">
<div class="checkbox list-item">
<label>
<input type="checkbox" data-bind="checked: isSelected, click: $parent.list, disable: $parent.disableInput()"/> <span data-bind="text: note">
</label>
</div>
</div>
我尝试进行检查复选框以移至顶部。当我单击未选中的复选框时,它需要在顶部移动。当我单击检查复选框时,它需要向后移动。
<div data-bind="foreach: lists">
<div class="checkbox list-item">
<label>
<input type="checkbox" data-bind="checked: isSelected, click: $parent.list, disable: $parent.disableInput()"/> <span data-bind="text: note">
</label>
</div>
</div>
I tried to do the checked checkboxes to move on top. When I click the unchecked checkbox, it needs to move on top. When I click the checked checkbox, it needs to move back down.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您将需要一个中间对象来保存排序列表。类似:
然后,您将
指向此计算值:
&lt; div data-bind =“ foreach:sorted_lists”&gt; ...
You're going to need an intermediate object to hold the sorted list. Something like:
Then you point your
foreach
to this computed value:<div data-bind="foreach: sorted_lists">...