How to create a blueprint to edit data in a table?


I’m very excited about simplictiy of Kirby and I think the concept behind it is very smart.
I’m testing if it fits our needs.

We have a table of data (just text and numbers).
To edit the data the most simple way would be to just click into a field of the table and change its value.
Is this possible via a blueprint in the panel?
I did not find anything about it in the documentation.

Kind regards

Currently, your best bet when it comes to tabular data is a structure field:

However, it doesn’t allow clicking into a cell to edit it, but you have to edit rows of data.

The Editor plugin comes with a table block as an add-on (in the examples folder), but I wouldn’t recommend using this block plugin at the moment, because the Editor is undergoing massive changes at the moment.

Hi Alain, welcome to the forum!

My personal preference is with the Structure field as well (editing rows of data suited my needs rather well so far), but you may want to peek at the Table field plugin – I have not yet used it myself, though, so can’t share any hands-on experience with it.

1 Like

Thanks alot for your hints, I will test it.

I tried to follow this explanation:

But I get lost at the point where storing data in YAML format is descripted.
To me it’s not clear where the YAML has to be stored and how it has to be written.

Let’s say I have it in /content/projects/datalist.yml
It contains the exampledata:

  Street: Rue de WTF 17
  ZIP:    1112
  City:   Monaco
  Phone:  555-1234

  Street: 1212 Broadway
  ZIP:    4321
  City:   New York
  Phone:  666-4321

  Street: At the beach
  ZIP:    9999
  City:   The capitol of the Bahamas
  Phone:  777-9999

In the Template of /content/projects I write:

$data = $page->datalist()->yaml();

But the dumb results always empty.
What do I do wrong?

I got it:
The YAML file with the backend structure (like all YAML files?) has to be stored in /blueprints/pages.
The data has to be stored in /content/projects/projects.txt
Ts ts, typical newbie question :blush:

Kind regards

A structure is a field, and all fields are saved to a “page” (which is a “template.txt” file in /content/projects/. (If your template is named project, the file should be named project.txt)

Imho for first time experience with structures it’s best to setup a blueprint for your project page that contains a structure field e.g. addresses. Add the needed fields (street, zip, city, phone, email) to that structure, login to the panel, create a new project page, add a few records and see how it’s stored in the txt file.

You can use your addresses list in a project template you can use var_dump($page->addresses->toStructure()); to visualize the collection of addresses for you to work with.

Starter blueprint:

title: project
preset: page
    label: Page title
    type: text

    label: Addresses
    type: structure
        label: Street
        type: text
        label: ZIP
        type: text
        label: City
        type: text