jeudi 29 janvier 2015

Knockout.js data-bind array to list of checkboxes


Patient 1
Patient.Age = '25'
Patient.Injury[0].Date = '2015-01-01'
Patient.Injury[0].Type = 'Burned'
Patient.Injury[1].Date = '2015-01-27'
Patient.Injury[1].Type = 'Sprained Ankle'

Patient 2
Patient.Age = '17'
Patient.Injury[0].Date = '2015-01-08'
Patient.Injury[0].Type = 'Papercut'

<!-- ko foreach: Patient -->
<input type="checkbox" data-bind="checked: ?"> Sprained Ankle
<input type="checkbox" data-bind="checked: ?"> Burned
<input type="checkbox" data-bind="checked: ?"> Papercut
<!-- /ko -->


Looping through an array of multiple patients and displaying a list of checkboxes of injury types of each patient. How do I select multiple checkboxes per patient, based off of sub-array of injuries?





Aucun commentaire:

Enregistrer un commentaire