DataTables warning: Non-table node initialisation (DIV). For more information about this error, plea

DataTables warning: Non-table node initialisation (DIV). For more information about this error, plea

ashu81ashu81 Posts: 2Questions: 2Answers: 0
edited August 26 in DataTables
       <script type="text/javascript" src="https://cdn.datatables.net/buttons/1.7.1/js/dataTables.buttons.min.js"> </script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.7.1/js/buttons.html5.min.js"></script>
    <script type="text/javascript">
   
        $(document).ready(function () {

            $("[id*=btnReport]").click(function () {
                //if ($.fn.dataTable.isDataTable("[id*=gvData]")) {
                //    t.destroy();
                //}
              //  $("[id*=gvData]").DataTable().clear().destroy();
                $(function ()
                {
                    var AcadYear = $('#<%= ddlAcadYear.ClientID %> option:selected').text();
                    var Branch = $('#<%= ddlBranch.ClientID %> option:selected').text();
                    var Class = $('#<%= ddlClass.ClientID %> option:selected').text();
                    $.ajax({
                        type: "POST",
                        url: "frmRptScholarshipDetail.aspx/GetFeeCollection",
                        data: "{'AcadYear':'" + AcadYear + "','Branch':'" + Branch + "','ClassName':'" + Class + "'}",
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        success: OnSuccess,
                        failure: function (response) {
                            alert(response.d);
                        },
                        error: function (response) {
                            alert(response.d);
                        }
                    });
                });
            });

        });
        function OnSuccess(response) {
            //  dtable.destroy();
            //if ($.fn.dataTable.isDataTable("[id*=gvData]")) {
            //    t.destroy();
            //}
            var dtable;
          //  dtable;
             dtable = $("[id*=gvData]").DataTable(
           // $("[id*=gvData]").DataTable(
            {
                destroy:true,
               // bDestroy: true,
                bLengthChange: true,
                lengthMenu: [[10, 20,50, -1], [10, 20, 50, "All"]],
                bFilter: true,
                bSort: true,
                bPaginate: true,
                data: response.d,
                dom: 'Bfrtip',
                buttons: [
                    'excelHtml5',
                    'pdfHtml5'
                ],
                columns: [{ 'data': 'Fee1' },
                          { 'data': 'Fee2' },
                          { 'data': 'Fee3' },
                           { 'data': 'Fee4' },
                            { 'data': 'Fee5' },
                             { 'data': 'Fee6' },
                          { 'data': 'Fee7' }]
            })
            ;
             dtable.ajax.reload();
        };
</script>

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • colincolin Posts: 12,611Questions: 0Answers: 2,154

    Have you followed the steps in the technical notes linked to in the error? That'll be the place to start,

    Colin

Sign In or Register to comment.