Kino.DataTable (Kino v0.2.0) View Source

A widget for interactively viewing enumerable data.

The data must be an enumerable of records, where each record is either map, keyword list or tuple. Structs however must be manually converted to maps.

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

Returns a specification to start this module under a supervisor.

Starts a widget process with enumerable tabular data.

Link to this section Types

Specs

t() :: %Kino.DataTable{pid: pid()}

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

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.

This function is deprecated. Use Kino.DataTable.new/2 instead.