fnGetData question

fnGetData question

MaddyMaddy Posts: 24Questions: 0Answers: 0
edited August 2012 in DataTables 1.9
i have a question regarding datatables fngetdata. Im using aData = oTable.fnGetData(aPos); to fetch a row from my datatable. I'm getting the data in array format. so my 1st column data will be aData[0], 2nd will be aData[1] and so on. Can I get the data in associative array format. For example, 1st column name is Group, so can the data be aData[Group]? I need this format because, my datatable is being populated from a mysql table and whenever I expand the table to add columns, I have to change the positions of all other columns. I want to remove the positional dependency. Please advise. Thank you.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    > Can I get the data in associative array format

    If you were to pass it in as an object, then yes. See: http://datatables.net/blog/Extended_data_source_options_with_DataTables .

    Basically fnGetData will return to you want you give it for the data for each row, or as an array if reading from the DOM.

    Allan
  • MaddyMaddy Posts: 24Questions: 0Answers: 0
    Wow Allan, this is an amazing option. Works perfectly!! Thanks a ton for this wonderful tool and your prompt replies :)
This discussion has been closed.