1 Reply Latest reply on Feb 18, 2020 10:17 AM by Duncan Mills-Oracle

    How to define CCA array sub-properties?

    Philip Sommer

      Hello Community,

       

      I would like to define a custom JET component and define an array of object-properties as a sub-property of this component. Example data:

      {
           columns: [
                {id: 1, description: "First column"},
                {id: 2, description: "Second column"},
           ]
      }
      

       

      I'm having trouble translating this into the component.json format. The following does not seem to work:

      {
           ...
           "properties": {
                "columns": {
                     "type": "Array",
                     "properties": {
                          "id": {...}
                          "description": {...}
                     }
                }
           }
           ...
      }
      

       

      I've also tried wrapping everything in the array in a "value" property:

      {
           ...
           "properties": {
                "columns": {
                     "type": "Array",
                     "properties": {
                          "value": {
                               "type": "Object",
                               "properties": {
                                    "id": {...}
                                    "description": {...}
                               }
                          }
                     }
                }
           }
           ...
      }
      

       

      Any way I can define this structure compliant with the OJET metadata definitions? https://www.oracle.com/webfolder/technetwork/jet/jsdocs/MetadataTypes.html#ComponentMetadataProperties  does not seem to cover this case in depth.

      Any help would be much appreciated.

       

      Kind Regards,

      Philip

       

      P.S.: I'm running JET 8.0.0.

        • 1. Re: How to define CCA array sub-properties?
          Duncan Mills-Oracle

          The sub-property (nested properties) syntax does not apply in the array case.  It is possible to provide extension metadata so that tooling Such as Oracle Visual Builder can provide a more useful design time experience to handle mapping the array contents in the Property Inspector.  However, if you are just using the component in JET then Closure syntax is sufficient for communicating the shape of the array members.  For example, you might have something like  this:

           

          "properties": {

           

             "data": {

             "displayName": "Calendar Data",

             "description": "DataProvider or data array containing the events to display on the calendar",

             "type": "oj.DataProvider|Array<id:object,title:string,start:string,end:string,allDay:boolean,editable:boolean,startEditable:boolean,durationEditable:boolean,rendering:string,overlap:boolean,color:string,backgroundColor:string,borderColor:string,textColor:string>",

          }

          So in that case the data property can either be a data provider or it can be an array with rows of the defined shape

          1 person found this helpful