Thanks for the suggestion, but modifying the models passed in (via list) is the exact approach we have to avoid, due to our models' persistence (the same model instances are used for the lifetime of the page, across many different UIs) and our backend (which will reject extra attributes like 'checked'). We must not alter the items passed in to the list.
Because of that, the only alternative I've found is to create a separate observable (checkedItems) for tracking the 'checked' attributes -- but that then introduces the problem of tracking which 'checked' attribute corresponds to which model, which is made more problematic in the view because mustache doesn't allow dynamic key lookups. The "checkboxFieldValue" helper is an ugly workaround for that, and it admittedly solves a problem we wouldn't have at all if we could just add that "checked" property to each user.
(One of my early prototypes used a simple list of booleans to track that, instead of a map keyed by userid/idfield -- that made it much easier to track which 'checked' attribute corresponds to which model, and it gives much cleaner use of can-value, but it runs into problems when the list gets manipulated: any insertions, deletions, or other operations which change the indexes end up messing up the checkboxes.)
Are you sure about id="{{id}}" being sufficient? A quick check shows that omitting the {{#id}} check results in a bunch of empty attributes repeated on every <input>, which is what we'd expect for the template output. Were you thinking about scope properties on the can.component tags, instead of raw html attributes in the template?
Because of that, the only alternative I've found is to create a separate observable (checkedItems) for tracking the 'checked' attributes -- but that then introduces the problem of tracking which 'checked' attribute corresponds to which model, which is made more problematic in the view because mustache doesn't allow dynamic key lookups. The "checkboxFieldValue" helper is an ugly workaround for that, and it admittedly solves a problem we wouldn't have at all if we could just add that "checked" property to each user.
(One of my early prototypes used a simple list of booleans to track that, instead of a map keyed by userid/idfield -- that made it much easier to track which 'checked' attribute corresponds to which model, and it gives much cleaner use of can-value, but it runs into problems when the list gets manipulated: any insertions, deletions, or other operations which change the indexes end up messing up the checkboxes.)
Are you sure about id="{{id}}" being sufficient? A quick check shows that omitting the {{#id}} check results in a bunch of empty attributes repeated on every <input>, which is what we'd expect for the template output. Were you thinking about scope properties on the can.component tags, instead of raw html attributes in the template?