如何在jqgrid中添加时间选择器字段...这是我的代码在这里如何添加在jqgrid中提交的时间选择器
这些是导入文件
<link rel="stylesheet" href="css/redmond/jquery-ui.css">
<link rel="stylesheet" href="css/redmond/jquery.ui.theme.css">
<link rel="stylesheet" href="css/ui.jqgrid.css">
<link rel="stylesheet" href="css/redmond/jquery-ui-timepicker-addon-1.4.3.css">
<script src="js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/jquery.jqGrid.src.js" type="text/javascript"></script>
<script src="js/grid.locale-en.js" type="text/javascript"></script>
<script src="js/grid-search.js" type="text/javascript"></script>
<script src="js/jquery-ui.min.js" type="text/javascript"></script>
<script src="jquery-ui-timepicker-addon-1.4.3.js" type="text/javascript"></script>
{name:'joinDate',index:'joinDate',width:4.5,
editable:true,editoptions:{size:12,
dataInit:function(elem){
$(elem).datetimepicker({dateFormat: 'dd-mm-yy',
timeFormat: 'H:mm',});
},
defaultValue: function(){
var currentTime = new Date();
var month = parseInt(currentTime.getMonth() + 1);
month = month <= 9 ? "0"+month : month;
var day = currentTime.getDate();
day = day <= 9 ? "0"+day : day;
var year = currentTime.getFullYear();
return year+"-"+month + "-"+day;
}},
editrules:{required:true},
formatoptions: {srcformat:'ISO8601Long', newformat:'d-M-y H:i'}},
任何人请回复我
谢谢你
答案 0 :(得分:2)
您可以使用jQuery UI插件Timepicker,例如,它允许实现纯timepicker
或datetimepicker
。您只需将$(el).datepicker
的使用情况替换为$(el).datetimepicker
,并添加datetimepicker
的选项。
The demo例如我为the demo创建的the answer的小修改。它演示了如何使用datetimepicker
。