【发布时间】:2015-10-01 17:45:33
【问题描述】:
我有一个申请,我必须提交月度报告和季度报告。我正在为月度报告使用 bootstrap-datepicker,并且我想在我的应用程序中保持相同的标准,因此如果我避免使用选择框来显示季度,那就太好了。 当您处于月视图模式时,这就是 bootstrap 提供的功能
这就是我想做的事
选中后,将选中该季度的所有 3 个月。
我检查了bootstrap-datepicker.js 文件,我只看到了表格生成代码:
DPGlobal.template = '<div class="datepicker">'+
'<div class="datepicker-days">'+
'<table class=" table-condensed">'+
DPGlobal.headTemplate+
'<tbody></tbody>'+
DPGlobal.footTemplate+
'</table>'+
'</div>'+
'<div class="datepicker-months">'+
'<table class="table-condensed">'+
DPGlobal.headTemplate+
DPGlobal.contTemplate+
DPGlobal.footTemplate+
'</table>'+
'</div>'+
'<div class="datepicker-years">'+
'<table class="table-condensed">'+
DPGlobal.headTemplate+
DPGlobal.contTemplate+
DPGlobal.footTemplate+
'</table>'+
'</div>'+
'</div>';
在DPGlobal 变量中是模板:
headTemplate: '<thead>'+
'<tr>'+
'<th class="prev">«</th>'+
'<th colspan="5" class="datepicker-switch"></th>'+
'<th class="next">»</th>'+
'</tr>'+
'</thead>',
contTemplate: '<tbody><tr><td colspan="9"></td></tr></tbody>',
footTemplate: '<tfoot>'+
'<tr>'+
'<th colspan="7" class="today"></th>'+
'</tr>'+
'<tr>'+
'<th colspan="7" class="clear"></th>'+
'</tr>'+
'</tfoot>'
感谢所有帮助
【问题讨论】:
-
用这个插件选宿舍是不是有点矫枉过正?毕竟一个季度只是一个年份数字和季度数字。如果是关于季度月份名称的本地化显示(以防 Q1、Q2、Q3、Q4 不够好),您可以使用 moment.js,您可能已经将它与 date-range- 结合使用选择器...
标签: javascript twitter-bootstrap datepicker