Sha256: 8ab4337bfce2b37b4f0525366425fd417192a95f816d7e5945b364111a09e430

Contents?: true

Size: 1.24 KB

Versions: 19

Compression:

Stored size: 1.24 KB

Contents

# Collection Table

The _Collection Table_ component provides a vertical table containing a collection of items. Use with _Active Record_ model instances, an array of objects that extend `ActiveModel::Naming`, or simple hash-like objects.

Field types are automatically inferred from their respective database columns and rendered using an appropriate formatter.

Pagination (provided by [Kaminari](https://github.com/kaminari/kaminari)) is enabled by default for larger collections.

See the [full keyword argument specification](options.html) for information on the various available options.

```rspec:html
collection = [
  User.new(name: 'John', email: 'john@example.com', enabled: true),
  User.new(name: 'Jane', email: 'jane@example.org', enabled: false),
  User.new(name: 'Peter', email: 'peter@example.org', enabled: false),
  User.new(name: 'Sally', email: 'sally@example.org', enabled: true)
]

subject do
  active_element.component.table collection: collection,
                                 fields: [:name, :email, :enabled],
                                 show: true,
                                 new: true,
                                 edit: true,
                                 destroy: true
end

it { is_expected.to include 'John' }
```

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
active_element-0.0.31 rspec-documentation/pages/010-Components/Tables/Collection Table.md
active_element-0.0.30 rspec-documentation/pages/010-Components/Tables/Collection Table.md
active_element-0.0.29 rspec-documentation/pages/010-Components/Tables/Collection Table.md
active_element-0.0.28 rspec-documentation/pages/010-Components/Tables/Collection Table.md
active_element-0.0.27 rspec-documentation/pages/010-Components/Tables/Collection Table.md
active_element-0.0.26 rspec-documentation/pages/010-Components/Tables/Collection Table.md
active_element-0.0.24 rspec-documentation/pages/010-Components/Tables/Collection Table.md
active_element-0.0.23 rspec-documentation/pages/010-Components/Tables/Collection Table.md
active_element-0.0.22 rspec-documentation/pages/010-Components/Tables/Collection Table.md
active_element-0.0.21 rspec-documentation/pages/010-Components/Tables/Collection Table.md
active_element-0.0.19 rspec-documentation/pages/010-Components/Tables/Collection Table.md
active_element-0.0.18 rspec-documentation/pages/010-Components/Tables/Collection Table.md
active_element-0.0.17 rspec-documentation/pages/010-Components/Tables/Collection Table.md
active_element-0.0.16 rspec-documentation/pages/010-Components/Tables/Collection Table.md
active_element-0.0.15 rspec-documentation/pages/010-Components/Tables/Collection Table.md
active_element-0.0.14 rspec-documentation/pages/010-Components/Tables/Collection Table.md
active_element-0.0.13 rspec-documentation/pages/010-Components/Tables/Collection Table.md
active_element-0.0.12 rspec-documentation/pages/010-Components/Tables/Collection Table.md
active_element-0.0.11 rspec-documentation/pages/010-Components/Tables/Collection Table.md