Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 引导数据采集器-设置startView:&x27;十年;,但不是现在的十年_Javascript_Backbone.js_Datepicker - Fatal编程技术网

Javascript 引导数据采集器-设置startView:&x27;十年;,但不是现在的十年

Javascript 引导数据采集器-设置startView:&x27;十年;,但不是现在的十年,javascript,backbone.js,datepicker,Javascript,Backbone.js,Datepicker,目前,我有startView显示当前十年,这是可以的,但我想让前十年成为startView,而不是当前十年 this.dobDatePickerView = new DatePickerView({ el: this.$('[name="dob"]'), startView : 'decade', endDate : this.sandbox.dates().fwFormat('date'), value : this.sandbox.dates().subtract

目前,我有startView显示当前十年,这是可以的,但我想让前十年成为startView,而不是当前十年

this.dobDatePickerView = new DatePickerView({ el: this.$('[name="dob"]'), startView : 'decade', endDate : this.sandbox.dates().fwFormat('date'), value : this.sandbox.dates().subtract('years', 18).fwFormat('date') }).render(); this.dobDatePickerView=new DatePickerView({ el:this.$('[name=“dob”]'), startView:“十年”, endDate:this.sandbox.dates().fwFormat('date'), 值:this.sandbox.dates().subtract('years',18)。fwFormat('date') }).render(); 我想从“十年视图”默认选择的年份中减去18年,因此不必预先选择“2013”,它应该默认为1995年。

也许可以尝试在日期选择器上单击/打开时调用setStartDate(),并在十年前设置日期

这可能有效:():


$('#dp1')。日期选择器();

通过将日期选择器与输入分离,并在选择器上设置默认值(而不是输入),您可以获得仅在选择日期后填充日期,但从任意值开始的内容。

no Cirgie,“在日期选择器上设置新的较低日期限制”。我不想设置较低的日期限制,只想设置datepicker中预先选择的默认年份,重要的是不设置输入值,只想引导用户选择与当前年份不同的默认年份。谢谢你,我想这已经足够好了,谢谢你的帮助,杰森
<div class="input-append date" id="dp1" data-date="01-01-1990" data-date-format="dd-mm-yyyy" data-date-viewmode="years">
    <input class="span2" size="16" type="text" readonly>
    <span class="add-on"><i class="icon-calendar"></i></span>
</div>
<script>
  $('#dp1').datepicker();
</script>