I have the following observable array:
self.Profiles =ko.observableArray( ko.utils.arrayMap(initialData, function (profile) {
return {
StartDate : formatDateOnly(profile.StartDate),
EndDate : formatDateOnly(profile.EndDate),
ProfileID :profile.ID,
ProfileName : profile.Name,
ProjectName : profile.ProjectName,
ReadingListID : profile.ReadingListID,
ReadingListName : profile.ReadingListName
};
}));
I want to bind a dropdown to the profiles to show the profile names, if the value of the drop down changes then I want to update span elements with the new corresponding values to the selected profileID.
<table id="readingListApplyToProfile" class="fullWidthTable">
<tr>
<td>
Profile:
</td>
<td>
<select id="cboProfile" name="cboProfile" data-bind="options: Profiles, optionsText: 'ProfileName', 'optionsCaption': 'Select profile...', optionsValue:'ProfileID'"></select>
</td>
</tr>
<tr>
<td>
End Date:
</td>
<td>
<span data-bind="'text':EndDate"></span>
</td>
</tr>
</table>
I cannot get the spans to update because the span elements are unaware of the dropdowns value, can anyone help me please. I am totally lost.
data-bind="text: getProfile.ProfileName"or something like that? - jonhopkins