Perry
June 12, 2018, 11:33am
1
Hello,
how to create a prefilled structurfield table ?
I tried it that way:
shipping_zone:
label: Versand-Zonen
type: structure
style: table
limit: 5
default:
- zone: 1
- zone: 2
- zone: 3
- zone: 4
- zone: 5
fields:
zone:
label: Zone
type: Number
readonly: true
price_eur:
label: Preis EUR
type: Number
price_chf:
label: Preis CHF
type: Number
Perry
June 12, 2018, 12:36pm
3
okay now i think the indentation is right,
shipping_zone:
label: Versand-Zonen
type: structure
style: table
limit: 5
default:
- zone: 1
- zone: 2
- zone: 3
- zone: 4
- zone: 5
fields:
zone:
label: Zone
type: Number
readonly: true
price_eur:
label: Preis EUR
type: Number
price_chf:
label: Preis CHF
type: Number
Do I understand correctly with default content is specified?
I don’t understand your question…
Perry
June 12, 2018, 1:02pm
5
yes my english…
what i looking for is:
when the editor add a new row the field zone is prefilled with continuous number
like excell the row numbers.
The default content is only created in the beginning, when there is not other content yet. It is not possible by default to add a continuous number to a new entry. You can do two things:
Create a custom structure field that adds the number on clicking the add button
Add the continuous number on saving using a hook.
Perry
June 12, 2018, 3:32pm
7
I found a not super smart solution but it works.
Added 5 rows and set the row numbers and then
updated the blueprint:
zone:
label: Zone
type: Number
readonly: true
Thank you @texnixe for you help