Closed jakob-r closed 6 years ago
Or we program something on our own which makes sure that the top row of the table stays always on top. This is quite cumbersome to my knowledge but would add fit more into our "design" maybe.
i can see the point but i would rather not suggest to create too much custom code here. thats very often not a good solution. is there something "existing" that works well enough?
The DataTables JavaScript thing that we also use in mlr-shiny and which I linked above.
Just to keep you all informed:
I had a closer look at the DataTables thingy. It offers many different options and styles. We could split large tables over several pages or use the scroll_y option (https://datatables.net/examples/basic_init/scroll_y.html) to always have a visible top row.
There are two ways how to incorporate DataTables into the tutorial:
I tried both. 1. was really annoying and complicated. 2. is much simpler and I got it to work. The only problem left at the moment is that the DataTables thingy is pretty sensitive to the order in which some js libraries are loaded and at the moment it only works if I exclude a js file necessary for the search function ...
Can you shortly describe what the problems were with 1.) and can you link me to your code where you try out 2.)? I could have a look.
Thanks!
I put what I tried reg. 2 in https://github.com/mlr-org/mlr-tutorial/tree/DataTable: I added the required dependencies to the mkdocs.yml and wrote a small script that currently runs DataTable on every table in the tutorial (selector needs to be refined). I also pushed the html-file for the integrated learners page where one js-file is out commented such that DataTables work.
Reg. 1): I tried this several weeks ago so I don't remember exactly:
Using the DT package works great when the html is generated by markdown::render
, but not when generating md and building the html with mkdocs. The solutions I googled (like recreating parts of markdown::render, first saving the htmlwidget separately and then including it in the html) were all much more complicated than what I needed to do for 2.
Hmm. When you change the order of the scripts and put js/tables.js
first both works. The JavaScript Console is also not so helpfull :disappointed:
Actually I don't hink it really sucks... :eyes: But! It could be a bit better (also the other tables in the Appendix). Mayor issue: The header row shoud be always visible so that you know what the 'x' stands for.
We could use the DataTables thingy which is quite easy to do out of R into (HTML)Markdown and is quite stable and established. Normal HTML Table will be still there.
Or we program something on our own which makes sure that the top row of the table stays always on top. This is quite cumbersome to my knowledge but would add fit more into our "design" maybe.