ThomasSiegmund / D3TableFilter

A table widget based on Max Guglielmi's "HTML Table Filter Generator" and D3.js
Other
65 stars 17 forks source link

Pre-select of Rows #17

Closed JoshMB8 closed 7 years ago

JoshMB8 commented 7 years ago

Hi Thomas,

Thank you again for your help with my previous question, really helped me out with my project. I have another question regarding the 'pre-selection' of rows in a table. I have managed to implement what I believe to be the correct method as rows are pre-selected when the table is generated. However I don't know how to/ seem to be able to work out how to make sure the first row of the table is selected.

Below is the code I have to render my table, using the rowStyles as suggested by documentaion for pre-selection of rows.

d3tf(y, tableProps = tableProps, edit = FALSE, selectableRows = 'single', extensions = extensions, rowStyles = c(rep("", 1), rep("info", 1)));

However this seems to pre-select the second row. as shown: d3tf row select

I'm sure this is another easy fix but again I haven't been able to find/ work out a solution based on the documentation. Any help with this would be greatly appreciated.

Thank you again for your help and for this great package!

ThomasSiegmund commented 7 years ago

rowStyles ist a character vector of the same length as the number oft rows. To select the first row only:

rowStyles=c("info", rep("", nrow(y)-1))

JoshMB8 commented 7 years ago

Perfect thank you very much!