problem with api scrollTo that is "not a function"

problem with api scrollTo that is "not a function"

FireFoxIIFireFoxII Posts: 17Questions: 10Answers: 0

Hi and sorry for my english...
I'm trying to implement scroller in my datatable that have more than 2000 rows...

This is my function

      var table = $("#table").DataTable({
        "columnDefs": [
          {
            "targets": [0],
            "searchable": false
          },
        ],
        "lengthMenu": [25, 50, 75, 100],
        "language": {
          "url": "../plugins/datatables/it_IT.txt"
        },
        "deferRender" : true,
        "scroller": true,
        "ajax": "load_data.php",
        "scrollCollapse": true,
        "initComplete": function () {
            this.api().row( 100 ).scrollTo();
        }            
      });

Proplem was that I have this error in chrome console

Uncaught TypeError: this.api(...).row(...).scrollTo is not a function

How to resolve this?

Answers

  • allanallan Posts: 63,783Questions: 1Answers: 10,511 Site admin

    First thing to do is make sure you are using the latest versions of DataTables and Scroller.

    If that doesn't fix it, please link to a test case showing the issue, per the forum rules.

    Allan

  • FireFoxIIFireFoxII Posts: 17Questions: 10Answers: 0
    edited March 2016

    Thanks... But now with latest version I get this error

    Uncaught TypeError: Cannot read property 'appendChild' of undefined

    Example here

    http://live.datatables.net/rogugiri/1/edit

  • allanallan Posts: 63,783Questions: 1Answers: 10,511 Site admin

    Two issues I can see:

    1. You don't have scrolling enabled (scrollY). Scroller should probably detect that and not initialise, but if you want to use scroller you need to have scrolling enabled.
    2. You have a local data source so use data rather than ajax.

    Allan

This discussion has been closed.