DT 0.4: Editing Tables, Smart Filtering, and More
This article is originally published at https://blog.rstudio.com/
It has been more than two years since we announced the initial version of the DT package. Today we want to highlight a few significant changes and new features in the recent releases v0.3 and v0.4. The full changes can be found in the release notes.
Now you can make a table editable through the new argument
datatable(..., editable = TRUE). Then you will be able to edit a cell by double-clicking on it. This feature works in both client-side and server-side (Shiny) processing modes. See here for examples.
Smart filtering in the server-side processing mode
Searching in the server-side processing mode has enabled the “smart” mode by default. Previously, this mode only works in the client-side processing mode. If you want to disable the smart filtering, you can set the initialization option in
options = list(search = list(smart = FALSE))). The smart filtering means spaces in the global search keyword for the table will have a special meaning: each returned record in the table should match all of the words separated by spaces. For example, a keyword “1234 abc” will match every record in the table that contain both “1234” and “abc” (in previous versions, this is just treated as a single keyword).
Shift + Clicking for row selection
After you have enabled row selection, you can hold the
Shift key and click to select multiple consecutive rows.
DTOutput() and renderDT() for Shiny apps
We have added functions
renderDT() as aliases of
renderDataTable(), respectively. This is because the latter two often collide with functions of the same names in shiny. You are recommended to use
renderDT() in Shiny apps, so that you don’t have to worry about forgetting the
DT:: qualifier (e.g.,
DT::renderDataTable). Naming is hard, and this was perhaps my biggest mistake in the initial version of DT. I was too optimistic that
DT::renderDataTable() could quickly and easily replace
shiny::renderDataTable() so we could drop the latter. It turned out that the two were not completely compatible initially, and had got more and more differences later (DT has many more features).
Versions 0.3 and 0.4 also include several bug fixes, and we appreciate all the bug reports and pull requests from DT users. In particular, we want to thank Xianying Tan (@shrektan) for his many helpful pull requests to implement new features and fix bugs.
Again, the full documentation is at https://rstudio.github.io/DT/. Please use Github issues if you want to file bug reports or feature requests, and use StackOverflow or RStudio Community if you have questions.
Please visit source website for post related comments.