簡體   English   中英

在Ajax成功計時選擇器無效后

[英]after Ajax success timepicker doesn't work

我想要一個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>",
                });

              }

成功獲取動態內容后,您必須重新啟動時間選擇器

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();
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM