View Source AshPyro.Extensions.Resource.DataTable.Column (AshPyro v0.0.1)

The configuration of a data table column in the AshPyro.Extensions.Resource extension.

By default, the tbody cell will be rendered with render_cell/1. You can also change the :type option to specify special kinds of rendering.

For bespoke rendering needs, you can provide a custom component inline or as a function capture:

import Phoenix.Component, only: [sigil_H: 2]
column :code do
  class "whitespace-nowrap"
  render_cell fn assigns ->
    ~H"""
    <PyroComponents.Core.icon name="hero-rocket-launch" />
    <%= Map.get(@row, @col[:name]) %>
    """
  end
end

Summary

Types

@type t() :: %AshPyro.Extensions.Resource.DataTable.Column{
  cell_class: AshPyro.Extensions.Resource.Schema.css_class(),
  class: AshPyro.Extensions.Resource.Schema.css_class(),
  description: binary(),
  label: binary(),
  name: atom(),
  path: binary(),
  render_cell: (map() -> binary()),
  resource_field_type:
    :attribute
    | :calculation
    | :aggregate
    | :has_one
    | :belongs_to
    | :has_many
    | :many_to_many,
  sortable?: boolean(),
  type: :default
}

Functions