2015-09-10 172 views
0

当前正在使用日期选择器。下图显示了日期选择器中可用的不同选项。我想知道是否有办法摆脱datepicker中的TodayLast 7 days行。日期选择器自定义选项

1]

下面是我在我的report_datepicker.js文件。

$(function() { 

$('#Loan_Report_TimePeriod_picker').remove(); 
$('#Loan_datepicker_report').daterangepicker({ arrows: false, id: 'Loan_Report_TimePeriod_picker', earliestDate: new Date(2000, 0, 1), latestDate: new Date() }); 
$('#Loan_Report_Datepicker_holder').prepend($('#Loan_Report_TimePeriod_picker')); 
$('#Loan_Report_TimePeriod_picker').css({ 'width': '700px', 'margin-top': '-1px', 'top': '0', 'left': '170px', 'right': '0' }); 

}); 
+1

这接缝一些非标准组件。 - 它会帮助分享它的名字 - 或者至少是平台:WPF?网站的? – Matyas

+0

不太确定,因为这是我在这里工作之前已经在工作中使用的现有日期选择器。有一个datepicker js,它具有日期选择器功能。我将它添加到上面的代码中。 –

+0

这是自举吗? – Nikki9696

回答

0

它看起来像你可能会使用找到的日期范围选取器库here

Here是关于配置预定义范围的章节。

我在粘贴的代码中看不到配置,所以应用程序可能会在其他位置设置选项。

+0

啊谢谢,所以这是一个客户日期选择器,而不是一个标准的C#之一。好吧,我会查看配置,看看这是否有助于我的问题。谢谢一帮Chris –

0

根据PARAMS使用,它看起来像日期时间选择器的Jomres版本 - Source code

你可以尝试以下方法:

$(function() { 
$('#Loan_Report_TimePeriod_picker').remove(); 
$('#Loan_datepicker_report').daterangepicker(
    { arrows: false, 
    id: 'Loan_Report_TimePeriod_picker', 
    earliestDate: new Date(2000, 0, 1), 
    latestDate: new Date(), 
    presetRanges: [ 
     {text: 'Month to date', dateStart: function(){ return Date.parse('today').moveToFirstDayOfMonth(); }, dateEnd: 'today' }, 
     {text: 'Year to date', dateStart: function(){ var x= Date.parse('today'); x.setMonth(0); x.setDate(1); return x; }, dateEnd: 'today' }, 
     {text: 'The previous Month', dateStart: function(){ return Date.parse('1 month ago').moveToFirstDayOfMonth(); }, dateEnd: function(){ return Date.parse('1 month ago').moveToLastDayOfMonth(); } } ] }); 
$('#Loan_Report_Datepicker_holder').prepend($('#Loan_Report_TimePeriod_picker')); 
$('#Loan_Report_TimePeriod_picker').css({ 'width': '700px', 'margin-top': '-1px', 'top': '0', 'left': '170px', 'right': '0' }); 
});