Mistake in API ?
Mistake in API ?
mathieufannee
Posts: 17Questions: 0Answers: 0
Hello Allan,
thanks for your great work: I use DataTables every day now!
I had a small remark:
when checking the API, I found that fnGetPosition says that "if given as a cell (as an argument), an array of [row index, column index (visible)] is given".
But if I am right, the returned array is [row index, column index (visible), column index], meaning the last value is the true index of the column (taking invisible columns into account).
Or is it discouraged to use the last value?
Mathieu
thanks for your great work: I use DataTables every day now!
I had a small remark:
when checking the API, I found that fnGetPosition says that "if given as a cell (as an argument), an array of [row index, column index (visible)] is given".
But if I am right, the returned array is [row index, column index (visible), column index], meaning the last value is the true index of the column (taking invisible columns into account).
Or is it discouraged to use the last value?
Mathieu
This discussion has been closed.
Replies
I've just pushed up a fix for this and the documentation on this site will be updated when I publish 1.9.4: https://github.com/DataTables/DataTables/commit/66e92ab655d3ca45214d3115254981f5f99a73d0
I would say that although use of the last index isn't specifically discouraged, but rather use of fnGetPosition is! What are you using it for? Although it won't be removed, I am actively trying to discourage its used.
Allan
For example, I'm using it in an UNDO-function:
when some cell content is changed by some user (with jEditable), I put the old content and cell position (X,Y) onto a stack. When the user clicks on 'Undo', the top of the stack is read ( [oldContent, x, y] ) so I can address the right position in the table to restore the content: fnUpdate( oldContent, y, x, false )
How would you do that without using fnGetPosition() ?
Allan