I have a problem here because whenever I clicked my search button my date picker is gone when the page refresh upon showing the resilt. Can anyone help me where to put my date picker in my function? TIA
Here is my code for the date picker:
$("#dates").datepicker({dateFormat: 'yy-mm-dd'});
*(#dates is my textbox for inputtiing date)
function refresh_table(){
myjstbl.clean_table();
type_val = $('#filtertype').val();
$.getJSON("<?=base_url()?>holiday/refresh_control",
{ type: type_val },
function(data){
if(data == "")
document.getElementById("lblStatus").innerHTML = "No records found!";
else
document.getElementById("lblStatus").innerHTML = "";
myjstbl.add_new_row();
myjstbl.insert_multiplerow_with_value(1,data);
});
}
Try it like this (however I don't know what is your html code, but I supose it will be generated in that callback function.
function refresh_table(){
myjstbl.clean_table();
type_val = $('#filtertype').val();
$.getJSON("<?=base_url()?>holiday/refresh_control",
{ type: type_val },
function(data){
if(data == "")
document.getElementById("lblStatus").innerHTML = "No records found!";
else
document.getElementById("lblStatus").innerHTML = "";
myjstbl.add_new_row();
myjstbl.insert_multiplerow_with_value(1,data);
$("#dates").datepicker({dateFormat: 'yy-mm-dd'});
});
}
However if you have multiple date pickers I sugest you to use class and change from $('#dates') to $('.dates')