Cannot seem to be able to use page.len(), get an "undefined" error

Cannot seem to be able to use page.len(), get an "undefined" error

tundrwdtundrwd Posts: 2Questions: 2Answers: 0
edited September 2014 in Free community support

When using the code below, I get an error "TypeError: 'undefined' is not an object (evaluating 'table.page.len')". As near as I can tell, this is "straight" from an example shown on page http://datatables.net/reference/api/page.len() (as I said, near as I can tell, since the table definition isn't shown, and more complete HTML, and there's only a very brief snippet of code displayed).

Here's the example code:

<html>
<head>
  <link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.2/css/jquery.dataTables.css">
</head>
<body>
  <table id="example">
    <thead>
        <tr><th>Sites</th></tr>
    </thead>
    <tbody>
      <tr><td>SitePoint</td></tr>
      <tr><td>Learnable</td></tr>
      <tr><td>Flippa</td></tr>
      <tr><td>Flippa01</td></tr>
      <tr><td>Flippa02</td></tr>
      <tr><td>Flippa03</td></tr>
      <tr><td>Flippa04</td></tr>
      <tr><td>Flippa05</td></tr>
      <tr><td>Flippa06</td></tr>
      <tr><td>Flippa07</td></tr>
      <tr><td>Flippa08</td></tr>
      <tr><td>Flippa9</td></tr>
      <tr><td>Flippa10</td></tr>
      <tr><td>Flippa11</td></tr>
      <tr><td>Flippa12</td></tr>
      <tr><td>Flippa13</td></tr>
    </tbody>
  </table>
  <script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"></script>
  <script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.2/jquery.dataTables.min.js"></script>
  <script>
  $(function(){
    $("#example").dataTable();
    
    var table = $('#example').DataTable();
    table.page.len( 12 ).draw();
  })
  </script>
</body>
</html>

The page/table are displayed on the page, but with the default of 10, not 12 (since the JS generated an error). The versions above of jquery and jquery.dataTables are the versions that are already being used, so I need to use these versions if at all possible - so if there is a problem with these versions, I need to know that.

This discussion has been closed.