许多数据采集器在页面上有范围

时间:2011-01-30 09:04:18

标签: javascript jquery jquery-ui date-range datapicker

我尝试了范围的Jquery UI datepicker示例。

http://jqueryui.com/demos/datepicker/#date-range

但是当我每页添加更多数据选择器时,他们不想正常工作。

var dates = $(names).datepicker({
    defaultDate: "+1w",
    dateFormat: 'dd.mm.yy',
    numberOfMonths: 2,
    onSelect: function (selectedDate) {
        var num = this.id.substr(4, 1); //num - number of datapicker with range, (date1_from, date1_to, ...)
        var other_datepic = this.id == "date" + num + "_from" ? $("#date" + num + "_to") : $("#date" + num + "_from");
        var option = this.id == "date" + num + "_from" ? "minDate" : "maxDate",
            instance = $(this).data("datepicker");
        date = $.datepicker.parseDate( //I think problem is here
        instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings);
        //dates.not( this ).datepicker( "option", option, date ); //I repace this line, whit line lower
        other_datepic.datepicker("option", option, date); 
    }
});

0 个答案:

没有答案