I have application where i need to display datepicker in conditional statement. I am using hot towel with durandal and knockout. Conditional statement parent is bound with knockout as shown below.
<section data-bind="foreach: resourceProperty">
<span data-bind="text: associatedStandardResourceProperty().name " style="width:150px;float:left;"></span>
<!-- ko if: associatedStandardResourceProperty().isDateTime -->
<div class="input-append date" id="dp3" data-date="12-02-2012" data-date-format="dd-mm-yyyy">
<input class="span2" size="16" type="text" value="12-02-2012" class="datepicker">
<span class="add-on"><i class="icon-th"></i></span>
</div>
<!-- /ko -->
Also , i have initiated binding in my view model in viewAttached event as shown below.
function viewAttached(view) {
$(view).find('#dummyDiv').datepicker();
$(view).find('#dp3').datepicker();
return true;
}
Here dummyDiv is temporary div which i am using for checking if datepicker is working proeprly without knockout statement and it is outside ko foreach . I have checked and there i am able to get binding properly for dummy datepicker outside of foreach.
I would like to know how to implement/enable date picker when we use it inside knockout for each with if condition as shown above.
Thanks.