dev
dev

Reputation: 918

Knockout with Jquery UI datepicker date display

Please see this link for details http://jsfiddle.net/pakpatel/5p6Uz/4/

Can we do the range in Datepicker, If first date choose [ 10/12/2012 ] then second date shouldn't be before 10/12/2012, Customer can select date after ex.[10/13/2012] in datepicker.

Could anyone explain me how to implement. Thanks in advance.

Upvotes: 0

Views: 839

Answers (1)

photo_tom
photo_tom

Reputation: 7342

By using the previous row's data as the new min, it makes it challenging.

Working demo is at http://jsfiddle.net/photo_tom/5p6Uz/24/

There were two things that were required.

  1. Added a computed observable to pass the previous row's choosedate value to the current row.
  2. Added a new minDate binding to set the mindate option on the date picker.

This is not a completed fiddle. It doesn't properly handle adds or deletes. This is because the ko.computables need to be rebuilt.


EDIT:

Updated to handle add / delete methods. Interesting problem, trying to transfer information between two different rows in the table. Good challenge.

Soution at http://jsfiddle.net/5p6Uz/34/.

Upvotes: 1

Related Questions