Pegase745 / sqlalchemy-datatables

SQLAlchemy integration of jQuery DataTables >= 1.10.x (Pyramid and Flask examples)
MIT License
159 stars 67 forks source link

'Legace datatables not supported, upgrade to >=1.10' using the version 10.10.15 #96

Closed ferchuni closed 7 years ago

ferchuni commented 7 years ago

I get a 'legacy datatables' error, but I'm using the version 10.10.15.

The library checks if the params include the 'sEcho' argument. The problem is that the argument seems to be present in the construction of the URL for the version 10.10.15

URL: sEcho=1&iColumns=8&sColumns=%2C%2C%2C%2C%2C%2C%2C&iDisplayStart=0&iDisplayLength=10&mDataProp_0=0&sSearch_0=&bRegex_0=false&bSearchable_0=false&bSortable_0=true&mDataProp_1=1&sSearch_1=&bRegex_1=false&bSearchable_1=true&bSortable_1=

The code seems to be this:

  if 'sEcho' in self.params:
            raise ValueError(
                'Legace datatables not supported, upgrade to >=1.10')

Version:

<script type="text/javascript"
        src="https://cdn.datatables.net/v/bs-3.3.7/jq-2.2.4/dt-1.10.15/b-1.3.1/b-colvis-1.3.1/r-2.1.1/se-1.2.2/datatables.min.js"></script>
ferchuni commented 7 years ago

I have figured out the problem. I have been using the compatibility mode -legacy- in the initialization and it sends the 'sEcho' parameter.

The compatibility mode is triggered by the use of the old 'sAjaxSource' parameter.

$('#example').DataTable( {
    serverSide: true,
    sAjaxSource: {
        url: '/data-source',
        type: 'POST'
    }
} );

https://datatables.net/manual/server-side#Legacy

Thanks for the great work :)

Pegase745 commented 7 years ago

No problem, thanks :)