1

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"*/
    }
    );
1
  • Your initialisation generally looks okay, but could you run your table through the DataTables debugger ( debug.datatables.net ) so we can see what the table state looks like? Also what does Firebug say your returned JSON is? Commented Mar 29, 2012 at 6:33

1 Answer 1

2

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 <

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.