Update documentation

Update documentation

LeadVisionaryLeadVisionary Posts: 8Questions: 0Answers: 0
edited August 2010 in Bug reports
The documentation for fnRender

http://www.datatables.net/usage/columns

states

- array:aData - the data for the row in question

Looking at this, one would expect the parameter to be a one dimensional array with indices corresponding to the columns. But to get to the column you want, you must use it like this:

[code]oObj.aData[oObj.iDataRow][oObj.iDataColumn][/code]

Array index 0 has the data for the row (anything beyond that is undefined), and the column is indexed from it. This is counter-intuitive. Suggestion to either reword "the data for the row in question", show a usage example, or both. Bigger suggestion: refactor the API (it doesn't make any sense to pass around a two dimensional array with only the first dimension filled in with data)

Replies

  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin
    Having a look at the code and my example, the aData parameter is in fact a 1D array, and not a 2D one. I'm not entirely sure how the above code works :-). I can see that it would if you used the oObj.oSettings.aoData array - but aData appears to be working as expected.

    I 110% agree with you that the arguments for this function completely suck. I totally regret the design decision originally made to do it that way, and I've not changed it as I don't want to break backwards compatibility with it. When DataTables 2 happens, then this will change!

    Regards,
    Allan
This discussion has been closed.