我想要一个24小时制的时间选择器。我的jquery代码:
success: function(data) {
table_plannings_type.rows().remove().draw();
$.each(data, function(index, value) {
somme_lundi = ( new Date("1970-1-1 " + value.new_lundi_heure_a) - new Date("1970-1-1 " + value.new_lundi_heure_de) ) / 1000 / 60 / 60;
somme_mardi = ( new Date("1970-1-1 " + value.new_mardi_heure_a) - new Date("1970-1-1 " + value.new_mardi_heure_de) ) / 1000 / 60 / 60;
somme_mercredi = ( new Date("1970-1-1 " + value.new_mercredi_heure_a) - new Date("1970-1-1 " + value.new_mercredi_heure_de) ) / 1000 / 60 / 60;
somme_jeudi = ( new Date("1970-1-1 " + value.new_jeudi_heure_a) - new Date("1970-1-1 " + value.new_jeudi_heure_de) ) / 1000 / 60 / 60;
somme_vendredi = ( new Date("1970-1-1 " + value.new_vendredi_heure_a) - new Date("1970-1-1 " + value.new_vendredi_heure_de) ) / 1000 / 60 / 60;
somme_samedi = ( new Date("1970-1-1 " + value.new_samedi_heure_a) - new Date("1970-1-1 " + value.new_samedi_heure_de) ) / 1000 / 60 / 60;
somme_dimanche = ( new Date("1970-1-1 " + value.new_dimanche_heure_a) - new Date("1970-1-1 " + value.new_dimanche_heure_de) ) / 1000 / 60 / 60;
table_plannings_type.row.add(["<td hidden></td>",
"<td class='text-center text_vertical td_profil_total'>" +value.libelle+ " <a class='action_supprimer_profil' hidden style='color:red ;' title='Supprimer'> <i class='fa fa-times-circle' style='font-size: 12px;'></i></a><input type='hidden' name='hidden_profil_total[]' class='hidden_profil_total' value='"+value.total+"'><input type='hidden' name='hidden_id_profil[]' id='hidden_id_profil' value='"+value.id_profil+"'></td>",
});
}
答案 0 :(得分:0)
成功获取动态内容后,您必须重新启动时间选择器
success: function(data) {
table_plannings_type.rows().remove().draw();
$.each(data, function(index, value) {
somme_lundi = ( new Date("1970-1-1 " + value.new_lundi_heure_a) - new Date("1970-1-1 " + value.new_lundi_heure_de) ) / 1000 / 60 / 60;
somme_mardi = ( new Date("1970-1-1 " + value.new_mardi_heure_a) - new Date("1970-1-1 " + value.new_mardi_heure_de) ) / 1000 / 60 / 60;
somme_mercredi = ( new Date("1970-1-1 " + value.new_mercredi_heure_a) - new Date("1970-1-1 " + value.new_mercredi_heure_de) ) / 1000 / 60 / 60;
somme_jeudi = ( new Date("1970-1-1 " + value.new_jeudi_heure_a) - new Date("1970-1-1 " + value.new_jeudi_heure_de) ) / 1000 / 60 / 60;
somme_vendredi = ( new Date("1970-1-1 " + value.new_vendredi_heure_a) - new Date("1970-1-1 " + value.new_vendredi_heure_de) ) / 1000 / 60 / 60;
somme_samedi = ( new Date("1970-1-1 " + value.new_samedi_heure_a) - new Date("1970-1-1 " + value.new_samedi_heure_de) ) / 1000 / 60 / 60;
somme_dimanche = ( new Date("1970-1-1 " + value.new_dimanche_heure_a) - new Date("1970-1-1 " + value.new_dimanche_heure_de) ) / 1000 / 60 / 60;
table_plannings_type.row.add(["<td hidden></td>",
"<td class='text-center text_vertical td_profil_total'>" +value.libelle+ " <a class='action_supprimer_profil' hidden style='color:red ;' title='Supprimer'> <i class='fa fa-times-circle' style='font-size: 12px;'></i></a><input type='hidden' name='hidden_profil_total[]' class='hidden_profil_total' value='"+value.total+"'><input type='hidden' name='hidden_id_profil[]' id='hidden_id_profil' value='"+value.id_profil+"'></td>",
});
$('.someclass').timepicker();
}