View Source Kino.DataTable (Kino v0.5.2)

A widget for interactively viewing enumerable data.

The data must be an enumerable of records, where each record is either map, struct, keyword list or tuple.

Examples

data = [
  %{id: 1, name: "Elixir", website: "https://elixir-lang.org"},
  %{id: 2, name: "Erlang", website: "https://www.erlang.org"}
]

Kino.DataTable.new(data)

The tabular view allows you to quickly preview the data and analyze it thanks to sorting capabilities.

data = Process.list() |> Enum.map(&Process.info/1)

Kino.DataTable.new(
  data,
  keys: [:registered_name, :initial_call, :reductions, :stack_size]
)

Link to this section Summary

Functions

Starts a widget process with enumerable tabular data.

Link to this section Types

Link to this section Functions

Specs

new(
  Enum.t(),
  keyword()
) :: t()

Starts a widget process with enumerable tabular data.

Options

  • :keys - a list of keys to include in the table for each record. The order is reflected in the rendered table. For tuples use 0-based indices. Optional.

  • :sorting_enabled - whether the widget should support sorting the data. Sorting requires traversal of the whole enumerable, so it may not be desirable for lazy enumerables. Defaults to true if data is a list and false otherwise.

  • :show_underscored - whether to include record keys starting with underscore. This option is ignored if :keys is also given. Defaults to false.