Reputation: 464
I'm trying to display some data from a list sharepoint and then using jquery Datatable plugin to show the data. I'm very sure its returning 2 rows but for some reason i keep getting a third row. Is there any reson why jquery Datatable plugin returning another row... I'm going crazy.. ** Sent it to a div and it has only 2 rowa See below
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
<thead>
<tr>
<<th>Title</th>
<th>Contact Number</th>
<th>Reason</th>
<th>Status</th>
<th>Date Due</th>
<th>Location</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<<th>Title</th>
<th>Contact Number</th>
<th>Reason</th>
<th>Status</th>
<th>Date Due</th>
<th>Location</th>
</tr>
</tfoot>
</table>
var data ='';
$(xData.responseXML).find("[nodeName='z:row']").each(function() {
var title = $(this).attr("ows_Title");
var store = $(this).attr("ows_Location");
var Reason = $(this).attr("ows_Reason");
var Status = $(this).attr("ows_Status");
var contactnumber = $(this).attr("ows_Contact_x0020_Number");
var datedue = $(this).attr("ows_Date_x0020_Due");
data += "<tr><td>" + title + "</td><td>" + contactnumber + "</td><td>" + Reason + "</td><td>" + Status + "</td><td>" + datedue + "</td><td>" + store + "</td></tr>";
});
$("#example tbody").append(data);
$('#example').dataTable(
{
/*"bFilter": true,
"bPaginate": true,
"bSort": true*/
/*"bJQueryUI": true,*/
/*"sPaginationType": "full_numbers"*/
}
);
Upvotes: 1
Views: 2596
Reputation: 37061
Your first row defined by <thead>
Your second row defined by <tbody>
and it contains the actual data
Your third row defined by <tfoot>
<-- this is the "third" row that you want to get rid of ?
also you got typo twice in your <<th>Title
remove one redundant <
Upvotes: 2