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
Add a comment  | 

1 Answer 1

Reset to default 0

You 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"
}

本文标签: