Skip to content

Core

Create and theme tables.

dt2()
Create a DT2 DataTable widget
dt2_theme()
Create a reusable DT2 theme

Columns & rendering

Target columns and control how cells are rendered.

dt2_cols_align()
Column align (Bootstrap 5 classes)
dt2_cols_hide()
Hide columns
dt2_cols_width()
Column widths (CSS)
dt2_cols_escape()
Escape/unescape columns content
dt2_cols_html()
Allow raw HTML rendering via columns.render
dt2_col_template()
Simple HTML template per column (replace {{VAL}})
dt2_cols_render_js()
Attach a raw JS render function to columns
dt2_cols_render_orthogonal()
Orthogonal render (display/sort/filter/type) per column
dt2_register_renderer()
Register a named JS renderer
dt2_use_renderer()
Use a named JS renderer on columns

Formatting

Numbers, dates and relative times.

dt2_format_number()
Format numeric columns (DataTables renderer: number)
dt2_format_number_abbrev()
Abbreviate large numbers with fixed decimals (k / M / B)
dt2_format_datetime()
Format date/time columns (DataTables renderer: datetime)
dt2_format_time_format()
Format a date/time using DataTables' datetime renderer, with locale
dt2_format_time_relative()
Relative time using moment.fromNow(), with locale

Options helpers

Build the DataTables options list.

dt2_order()
Define initial ordering (option order)
dt2_search_global()
Set global search (option search)
dt2_length_menu()
Length menu helper
dt2_language()
Language helper (either list or JSON url)
dt2_use_buttons()
Enable Buttons (extension) and define buttons
dt2_buttons()
Configure DataTables Buttons and (optionally) move them to a custom container

Inline inputs

Per-row widgets for Shiny.

dt2_col_checkbox()
Checkbox input per row
dt2_col_button()
Action button per row

Shiny

Output, render and events.

dt2_output()
Shiny output for DT2
render_dt2()
Shiny render function for DT2
observe_dt2_events()
Observe DataTables events published by dt2.js
dt2_state()
Access the current state snapshot of a DT2 table

Shiny proxy

Update a live table without re-rendering.

dt2_proxy()
Create a proxy for a DT2 table
dt2_replace_data()
Replace all data in the table (proxy)
dt2_draw()
Redraw the table (proxy)
dt2_proxy_order()
Order the table (proxy)
dt2_proxy_search()
Global search (proxy)
dt2_proxy_page()
Page navigation (proxy)
dt2_select_rows()
Select rows (proxy; Select extension)

Server-side processing

Stream large data from the server.

dt2_bind_server()
Bind a DataTables v2 server-side endpoint to a widget id
dt2_ssp_handler()
Default server-side handler (filter/order/page)

Extensions & maintenance

Inspect and update bundled libraries.

dt2_extensions()
List available DataTables extensions
dt2_check_updates()
Check for DataTables library updates
dt2_update_libs()
Update DataTables JS/CSS libraries (developer tool)