table.page.info() not working
table.page.info() not working
<%@ 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
What exactly is not working?
Do you get errors, incorrect results?
Kevin
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/
This FAQ will answer your question.
Kevin
if u go the jsfiddle, it will show the error message in console.
kindly try it , then u can see the problem.
Kevin already gave you the answer.
i am new to datatable, so if u can point out, it will be helpfull.
You have
var table11 = $('#tblReport1').dataTable({
. To use the Datatables API you need to usevar table11 = $('#tblReport1').DataTable({
. Note theD
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