Get my json data back!

Get my json data back!

datatableryopmailcomdatatableryopmailcom Posts: 9Questions: 3Answers: 0

Hello, Allan!

Your table is very nice. It was nice, and I hope it will be.

I'm migrating from 1.9.4 to 1.10.9. And it is really hard for me.

Why didn't you keep back-compatibility? Probably it can be done via couple of wrappers around new api with old calls.

My question:

Before I've used old api calls:

var aaData = oTable.fnGetData();

// Thereafter any extension in width or height. I'm extending width, with new columns, dynamically, depending on the host data.
// Thereafter destroy Old DataTable and re-create New one with new formatted aaData.

Now, I'm stuck with question: How to get raw, pure json, that my DT ate before?

I'm trying:

var aaData = oTable.columns().data().toArray(); // it is raw array without sub-arrays.
// Something like: [null, null, null, null, null, "#", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, nul...

var aaData = oTableCrossBots[ 'balance' ].columns().data(); // the same.

I'm trying:
var aaData = oTableCrossBots[ 'balance' ].rows().data(); // There is api as garbage payload.

I'm trying:
var aaData = oTableCrossBots[ 'balance' ].rows().data().toArray(); // As you suggesting on the forum. It is again raw array without sub-arrays. Without separation by "NEW ROW"!

How to get Pure Json Back????

Cheers! I'm your fan!

Answers

  • datatableryopmailcomdatatableryopmailcom Posts: 9Questions: 3Answers: 0

    By the way, is there table for migrating from 1.9 to 1.10???

    For example,
    .fnGetNodes = .rows.nodes

    .fnAddData = .rows.add

    .fnUpdate = ?

    .fnAddData = ?

    etc....???

  • datatableryopmailcomdatatableryopmailcom Posts: 9Questions: 3Answers: 0

    Solved. Closed.

    My data was not properly added,

    I've used:

    rows.add( [a,b,c,d,] )

    instead of

    row.add( [a,b,c,d,] )

    And it added each element of new row as separate row. Or something like that.

    Thank you for attention (:

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    Good to hear you got it working. It is worth noting that DataTables 1.10 does retain backwards compatibility for the legacy API - just initialise the table with $().dataTable() to access the legacy API.

    Allan

This discussion has been closed.