admin管理员组文章数量:1126078
My questions kinda sums up my problem. I want to know how can I show a specific field like "state" as the title of my component entry when collapsed if that's possible?
For example, instead of showing "5" here I would like to show "Mayland". Is this possible in Strapi?
Edit, here is my component json:
{
"collectionName": "components_credits_cle_credits",
"info": {
"displayName": "CLE Credits",
"description": ""
},
"options": {},
"attributes": {
"credits": {
"type": "decimal",
"required": true
},
"state": {
"type": "enumeration",
"enum": [
"Alabama",
"Alaska",
"Arizona",
"Arkansas",
"California",
"Colorado",
"Connecticut",
"Delaware",
"Florida",
"Georgia",
"Hawaii",
"Idaho",
"Illinois",
"Indiana",
"Iowa",
"Kansas",
"Kentucky",
"Louisiana",
"Maine",
"Maryland",
"Massachusetts",
"Michigan",
"Minnesota",
"Mississippi",
"Missouri",
"Montana",
"Nebraska",
"Nevada",
"New Hampshire",
"New Jersey",
"New Mexico",
"New York",
"North Carolina",
"North Dakota",
"Ohio",
"Oklahoma",
"Oregon",
"Pennsylvania",
"Rhode Island",
"South Carolina",
"South Dakota",
"Tennessee",
"Texas",
"Utah",
"Vermont",
"Virginia",
"Washington",
"West Virginia",
"Wisconsin",
"Wyoming"
],
"required": true
},
"type": {
"type": "enumeration",
"enum": [
"Ethics",
"Paralegal"
],
"required": true
}
}
}
My questions kinda sums up my problem. I want to know how can I show a specific field like "state" as the title of my component entry when collapsed if that's possible?
For example, instead of showing "5" here I would like to show "Mayland". Is this possible in Strapi?
Edit, here is my component json:
{
"collectionName": "components_credits_cle_credits",
"info": {
"displayName": "CLE Credits",
"description": ""
},
"options": {},
"attributes": {
"credits": {
"type": "decimal",
"required": true
},
"state": {
"type": "enumeration",
"enum": [
"Alabama",
"Alaska",
"Arizona",
"Arkansas",
"California",
"Colorado",
"Connecticut",
"Delaware",
"Florida",
"Georgia",
"Hawaii",
"Idaho",
"Illinois",
"Indiana",
"Iowa",
"Kansas",
"Kentucky",
"Louisiana",
"Maine",
"Maryland",
"Massachusetts",
"Michigan",
"Minnesota",
"Mississippi",
"Missouri",
"Montana",
"Nebraska",
"Nevada",
"New Hampshire",
"New Jersey",
"New Mexico",
"New York",
"North Carolina",
"North Dakota",
"Ohio",
"Oklahoma",
"Oregon",
"Pennsylvania",
"Rhode Island",
"South Carolina",
"South Dakota",
"Tennessee",
"Texas",
"Utah",
"Vermont",
"Virginia",
"Washington",
"West Virginia",
"Wisconsin",
"Wyoming"
],
"required": true
},
"type": {
"type": "enumeration",
"enum": [
"Ethics",
"Paralegal"
],
"required": true
}
}
}
Share
Improve this question
edited Jan 9 at 7:29
user2342348
asked Jan 9 at 5:40
user2342348user2342348
511 silver badge3 bronze badges
4
- can you share the component json for strapi? – NeERAJ TK Commented Jan 9 at 5:44
- Where can I get this? – user2342348 Commented Jan 9 at 7:04
- components/<component-category>/<component-name>/component.json – NeERAJ TK Commented Jan 9 at 7:23
- @NeERAJTK Added it in my question, thank you – user2342348 Commented Jan 9 at 7:29
1 Answer
Reset to default 0You can update your component.json to include displayName to state as :
{
"collectionName": "components_credits_cle_credits",
"info": {
"displayName": "CLE Credits",
"description": ""
},
"options": {
"useDynamicDisplayName": true
},
"attributes": {
"credits": {
"type": "decimal",
"required": true
},
"state": {
"type": "enumeration",
"enum": [
"Alabama",
"Alaska",
"Arizona",
"Arkansas",
"California",
"Colorado",
"Connecticut",
"Delaware",
"Florida",
"Georgia",
"Hawaii",
"Idaho",
"Illinois",
"Indiana",
"Iowa",
"Kansas",
"Kentucky",
"Louisiana",
"Maine",
"Maryland",
"Massachusetts",
"Michigan",
"Minnesota",
"Mississippi",
"Missouri",
"Montana",
"Nebraska",
"Nevada",
"New Hampshire",
"New Jersey",
"New Mexico",
"New York",
"North Carolina",
"North Dakota",
"Ohio",
"Oklahoma",
"Oregon",
"Pennsylvania",
"Rhode Island",
"South Carolina",
"South Dakota",
"Tennessee",
"Texas",
"Utah",
"Vermont",
"Virginia",
"Washington",
"West Virginia",
"Wisconsin",
"Wyoming"
],
"required": true
},
"type": {
"type": "enumeration",
"enum": [
"Ethics",
"Paralegal"
],
"required": true
}
},
"displayName": "state"
}
本文标签:
版权声明:本文标题:javascript - Strapi 4 how to edit title of the component to show a different field than the "id" field when co 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736670777a1946908.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论