Open ismirsehregal opened 8 months ago
This function was originally contributed by @gergness via the PR #527. It might be clearer if you read the documentation of DataTables: https://datatables.net/reference/api/colReorder.order()
Anyway, @gergness do you have time to contribute one more time to clarify the doc here? Thanks!
Ha, never fun to re-read what I wrote a long time ago.
I'm having trouble improving the docs, I think the underlying functionality is confusing because the code is having to jump between javascript and R, so here's my first stab at it, but I wonder if @ismirsehregal has any suggestions:
A vector of column positions to reorder the columns in. This vector is passed directly to data.table javascript instance, so the indexing may behave differently than expected: it starts at 0, includes the row.names if they are displayed in the table, and also must include all column even those that have been hidden with
hideCols()
orshowCols()
. This functionality requires the datatable has extension 'ColReorder' turned on (see https://rstudio.github.io/DT/extensions.html).
Thanks @gergness this is much better (I'm not a native speaker, so maybe my lack of understanding is partly my own fault).
What about:
A vector of column positions to reorder the columns in. This vector is passed directly to the datatable javascript instance, so the indexing starts at 0. Furthermore, it includes the column position of the row.names if they are displayed in the table. The vector also must include all hidden columns (see hideCols() or showCols()). This functionality requires the datatable has extension 'ColReorder' turned on (see https://rstudio.github.io/DT/extensions.html).
Oh gosh, no, I don't think it made a ton of sense to native speakers either.
That seems good to me! Happy to make the PR or you can if you want @ismirsehregal
Would be great if you make the PR (I'm currently only on mobile). Thank you!
I just visited
?dataTableProxy
And I think the description of
colReorder()
's order parameter needs an update - it is unclear to me: