Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bobdenotter/gridviewfield
A Gridview Field extension for Bolt contenttypes.
https://github.com/bobdenotter/gridviewfield
Last synced: 25 days ago
JSON representation
A Gridview Field extension for Bolt contenttypes.
- Host: GitHub
- URL: https://github.com/bobdenotter/gridviewfield
- Owner: bobdenotter
- Created: 2015-01-09T15:50:32.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-10-04T15:57:27.000Z (about 7 years ago)
- Last Synced: 2024-05-01T20:38:27.175Z (6 months ago)
- Language: HTML
- Size: 665 KB
- Stars: 8
- Watchers: 6
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Gridview Field
==============This extension allows you to add a gridfield to your contenttypes, that you can
use to quickly add tabular data. After installing the extension, add a field to
a contenttype in `contenttypes.yml`, like this:```
grid:
type: grid
sorting: true
rowheaders: true
rowmove: true
columns:
firstname: First name
lastname: Last name
address: Address
zipcode: Zip code
city: City
country: Country
email: Email
password: Password
height: 300
```The field can have the following field-level options:
* `sorting`: A boolean (true/false) setting if the columns should be sortable.
* `rowheaders`: A boolean (true/false) setting if an incrementing number should be shown for each row.
* `rowmove`: A boolean (true/false) setting if a row can be drag-and-dropped to move it.
* `columns`: A array/hash of the column names to be shown at the top of a column.
* `colheaders`: A boolean (true/false) setting if column headers should be shown or not. Overridden by columns.
* `maximumcols`: A number of the maximum columns allowed in the grid.
* `minimumcolumns`: A number of the minimum columns allowed in the grid.
* `height`: A number to set the height of the field.To output the result in your templates, you can access `record.grid`, like any
other field in your records. If you've renamed the field in your contenttype,
you'll obviously need to use the changedname here as well. To get a quick dump
of what's in there, use:```
{{ dump(grid) }}
```In most cases you'll wish to display the information from the grid as a table
in the template. USe the following snippet to do so:```
{% if record.grid is json %}
{% set grid = record.grid|json_decode %}
{% for row in grid %}
{% for cell in row %}
{{ cell }}
{% endfor %}
{% endfor %}
{% else %}
No grid.
{% endif %}
```This extension uses the [Handsontable][ht] javascript spreadsheet library.
[ht]: https://handsontable.com/