DT 1.10 - ajax[success:] property preventing columns[data:] from being set

DT 1.10 - ajax[success:] property preventing columns[data:] from being set

dynamiclynkdynamiclynk Posts: 4Questions: 1Answers: 0
edited May 2014 in Bug reports

Is it by design if you have for example the success property set

ajax: {
            dataSrc: 'data',
            url: baseURL + 'Resource/Data',
            type: 'POST',
            success: function (data) {
                v = data;
                s = JSON.stringify(v);
            }
        }

It will prevent the columns data from being set

columns: [
            { data: 'Field1' },
            { data: 'Field2' }
]

Once I comment out the below the columns are displayed correctly.

success: function (data) {
                v = data;
                s = JSON.stringify(v);
            }

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 56,187Questions: 1Answers: 8,894 Site admin
    Answer ✓

    Yes, the ajax documentation says:

    success - Must not be overridden as it is used internally in DataTables. To manipulate / transform the data returned by the server use ajax.dataSrcDT (above), or use ajax as a function (below).

    Although in the documentation I can see more questions like this in future. I'll look at adding this ability in a future release.

    Allan

This discussion has been closed.