table.page.info() not working

table.page.info() not working

r yadavr yadav Posts: 7Questions: 2Answers: 0

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="PipeTrakWebApp.WebPages.PC.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="../Scripts/jquery-3.4.1.js"></script>
<script src="../Scripts/jquery.dataTables.js"></script>
<script type="text/javascript">

     function ddd() {

         var dd = [
             {
                 "name": "Tiger Nixon",
                 "position": "System Architect",
                 "salary": "$3,120",
                 "start_date": "2011/04/25",
                 "office": "Edinburgh",
                 "extn": 5421
             }
         ];
         var table11 = $('#tblReport1').dataTable({
             "data": dd
             ,
             "columns": [
                 { "data": "name" },
                 { "data": "position" },
                 { "data": "salary" },
                 { "data": "start_date" },
                 { "data": "office" },
                 { "data": "extn" }
             ]
         });

         alert(table11.page.info());
     }
</script>

</head>
<body>
<form id="form1" runat="server">
<div>
<table id="tblReport1" border="0" ><thead></thead><tbody></tbody></table>

        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
        <input id="Button2" type="button" onclick="ddd();" value="button" /></div>

</form>

</body>
</html>

Answers

  • kthorngrenkthorngren Posts: 21,172Questions: 26Answers: 4,922

    table.page.info() not working

    What exactly is not working?

    Do you get errors, incorrect results?

    Kevin

  • r yadavr yadav Posts: 7Questions: 2Answers: 0

    ya it shows error.

    https://jsfiddle.net/ryadav/c4bzv187/

    here i have tried table11.page().info also.

    and in following it does not show error.

    https://jsfiddle.net/ryadav/t7epwmxu/15/

  • kthorngrenkthorngren Posts: 21,172Questions: 26Answers: 4,922

    This FAQ will answer your question.

    Kevin

  • r yadavr yadav Posts: 7Questions: 2Answers: 0

    if u go the jsfiddle, it will show the error message in console.
    kindly try it , then u can see the problem.

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    Kevin already gave you the answer.

  • r yadavr yadav Posts: 7Questions: 2Answers: 0

    i am new to datatable, so if u can point out, it will be helpfull.

  • kthorngrenkthorngren Posts: 21,172Questions: 26Answers: 4,922

    You have var table11 = $('#tblReport1').dataTable({. To use the Datatables API you need to use var table11 = $('#tblReport1').DataTable({. Note the D in DataTable. Please read the FAQ I linked and the page it links to for details. Here is the updated code:
    https://jsfiddle.net/n80qymkg/

    Kevin

This discussion has been closed.