How to get all data?

How to get all data?

chucky2183chucky2183 Posts: 2Questions: 0Answers: 0
edited January 2012 in General
Hi. I'm new with this excellent framework.

Well i use DT for an invoice details. I create a new table and i add data very fine. Now i want to know how i get all data from the datatable. I fill all, and then when i finished, i need to get data to save in the database.

Can anyone help me please?

Sorry for my english, isn't very good

Thanks

Replies

  • allanallan Posts: 63,687Questions: 1Answers: 10,500 Site admin
    The fnGetData API method?

    Allan
  • chucky2183chucky2183 Posts: 2Questions: 0Answers: 0
    Ty Allan. Can you put an example? Because i need all data.
  • allanallan Posts: 63,687Questions: 1Answers: 10,500 Site admin
    [code]
    var oTable = $('#whatever').dataTable();
    oTable.fnGetData();
    [/code]

    Allan
  • n3wb13n3wb13 Posts: 5Questions: 0Answers: 0
    fnGetData(); returns a 2D array of the entire table. But is there any way to return a multi-dimension array or convert the data in the table to JSON format and then post it back to the server?
  • allanallan Posts: 63,687Questions: 1Answers: 10,500 Site admin
    I don't understand - the 2D array is multi-dimensional (two dimensional to be exact!). It contains all of the data in the table. It is just a Javascript array so you can use JSON.strigify to send it as a string.

    Allan
  • n3wb13n3wb13 Posts: 5Questions: 0Answers: 0
    Yeah it works fine. So sorry for my stupidity.
  • maadsomaadso Posts: 4Questions: 0Answers: 0
    edited May 2014

    Hi Allan,

    I'm trying to get all the data from the table, but when I use fnGetData(), it leaves out the header. Is there another call I can use to get everything in the entire table?

    Thanks!

    --edit: saw your response to my other post, so sorry for duplicate questions! Check Allan's answer here: http://www.datatables.net/forums/discussion/comment/60182#Comment_60182

This discussion has been closed.