取消选中随每个循环插入的所有复选框

时间:2015-06-05 21:15:47

标签: ember.js ember-data

我想知道如何取消选中此模板中的所有复选框,我尝试使用jquery,但它在isChecked上与我的观察者混淆:

<script type="text/x-handlebars" data-template-name="conversations">   
{{#each conv in model itemController='singleconv'}}
    <div class="conversation-content-wrapper" {{action "clickConv" conv preventDefault=false}}>
            <div class="history-message-assigned in-progress-closed" style="display:none;"><p><i class="icon-x"></i>Conversation closed</p></div>
            <div class="history-message-assigned in-progress-assignation" style="display:none;"><p><i class="icon-assign"></i>Conversation assigned</p></div>
            <div class="history-message-assigned in-progress-reopen" style="display:none;"><p><i class="icon-re-opened"></i>Conversation re-opened</p></div>          
        <div class="conversation-history">          
            <div class="conversation-time-history">{{{conv.timeAgoElement}}}</div>
            <div class="conversation-details">
                <span class="unread-numbers"></span>
                    {{input type='checkbox' class='chk-conversation' checked=conv.isChecked}}
                     <span class="conversation-name">{{conv.customer.name}}</span>
                     <span class="phone-number">{{conv.customer.cellPhoneNumber}}</span>
                    <p class="conversation-text">{{conv.lastMessage}}</p>
            </div>
        </div>                       
    </div>
{{/each}}     
</script>

如何检索此模型复选框的所有实例并在函数中取消选中它们?

1 个答案:

答案 0 :(得分:0)

根据每个模型char[]属性选中复选框。

如果您遍历每个模型并将isChecked更改为isChecked,则会取消选中所有复选框。