I have a table that is showing the data from the database.the code is listed below:
<table class="table table-hover table-bordered" style="width:300px" id="contact">
<tbody data-bind="foreach:items">
<tr>
<td style="height:180px" data-bind="text:title1"></td>
</tr>
</tbody>
</table>
and the i am using ajax to fetch the data:
$(function(){
$('.datepicker').datepicker({
dateFormat: 'M dd,yy',
onSelect: function(dateText, inst) {
var date = $(this).datepicker('getDate');
var dateFormat = inst.settings.dateFormat || $.datepicker._defaults.dateFormat;
$('#date').text($.datepicker.formatDate( dateFormat, date, inst.settings));
var month = date.getMonth() + 1;
var day = date.getDate();
var year = date.getFullYear();
var date1 = year + "/" + month + "/" + day;
$.post(root+"home/index?json",{date:date1}, function(data) {ko.applyBindings(new DynamicModel(data.calendar1),document.getElementById("contact"));});
},
});
});
Table is showing the data that is coming from the database but is getting vanished when there is no data from the database
so please help me for this..
Adding a thead will help as then it will at least show the header. Since the empty table will not generate any code I am guessing it is not showing up