Context
When making an interactive table using the DataTables library, columns are hidden under a green + sign when the screen width becomes too narrow for the number and width of columns. As the screen width decreases, the right hand column is always the next to be hidden.
Question
Is it possible to specify the order in which columns are hidden as the screen width decreases? As an example, say I would like my ‘description’ column (which has a short paragraph of text for each row of the table) to display at the right of my table, and remain showing as the screen width decreases, with columns to its left being hidden before it.
library(DT)
df <- data.frame(column_1 = 1:10,
column_2 = rep(1,10),
column_3 = rep("some text"),
column_4 = seq(2,29,3),
column_5 = 5:14,
description = rep("Here is some very long and wordy text. I would like this text to remain hidden under the green + sign that appears when the screen becomes narrow. In real life, I have many more columns than this, and want as many of them to display as possible, but this column to remain hidden even with a very wide screen.", 10))
datatable(df,
extensions = "Responsive")
Note: I am using the R DT library in flexdashboard, but I expect this question is relevant for other uses of DataTables (e.g. in javascript).