$(function () { pageContext.i18n.modTalk = 'moderation talk'; pageContext.i18n.replyToComment = 'Reply'; pageContext.i18n.modTalkEmpty = 'moderation talk is empty'; pageContext.url.getModTalk = "/comments/%25ID%25/listModTalk.json"; pageContext.url.possibleCommentRecipients = "/comments/%ID%/possibleRecipients.json"; pageContext.url.commentEdit = '/comments/%25ID%25/edit.html'; pageContext.url.commentView = '/comments/%ID%/view.html'; pageContext.i18n.commentVisibility = { 'full': 'Viewable by all users', 'op': 'Viewable by the original poster', 'mod': 'Viewable by moderators', 'opAndMod': 'Viewable by moderators and the original poster', 'other': 'Advanced visibility', 'dialogTitle': 'Comment visibility', 'selectGroups': 'Visible to groups', 'selectOther': 'Other recipients', 'selectOriginalPoster': 'Original poster', 'selectModerators': 'Moderators', 'selectAssignees': 'Asked to answer users' }; pageContext.i18n.commentMenuLabels = { 'comment-edit': 'comments.menu.edit', 'comment-delete': 'comments.menu.delete', 'comment-convert': 'comments.menu.convert' };pageContext.i18n.answer= { bestAnswer: 'Best Answer', controlBar : { accept: 'Accept', unaccept: 'Unaccept', acceptCommand: 'Accept this answer as correct', cancelAcceptedCommand: 'Remove this answers accepted status' } }; window.croles = { u: false, op: false, m: false, og: false, as: false, ag: false, dc: false, doc: false, eo: false, ea: false }; tools.init({ q: { e: false, ew: false, eo: false, r: false, ro: false, d: false, dow: false, fv: false, c: false, co: false, p: false, tm: false , ms: false, mos: false }, n: { f: false, vf: false, vfo: false, vr: false, vro: false, c: false, co: false, vu: false, vd: false, w: false, wo: false, l: false }, c: { e: false, eo: false, d: false, dow: false, ta: false, tao: false, l: false }, a: { e: false, ew: false, eo: false, d: false, dow: false, a: false, aoq: false, ao: false, tc: false, tco: false, p: false, tm: false }, pc: croles }, { tc: true, nsc: true }); commandUtils.initializeLabels(); }); Skip to Content

Assign an array as Default Value to property in contribution.xml

In my contribution.xml for an extension, I have a property like below:

<property
  id="values"
  title="Values"
  type="Array"
 />
<initialization>
       <defaultValue property="values">
            [10,12,13,16,9]
       </defaultValue>
</initialization>

I am getting error in Design Studio.

If I use property of type int then I have no problem. I guess I am passing the array incorrectly as default value. Any idea ?

Add comment
10|10000 characters needed characters exceeded

  • I have modified the contribution.xml as below:

           <property
                id="xAxis"
                title="x-Axis"
                type="Array">
                <property
                    id="xValues"
                    title="x-Axis Values"
                    type="int"
                />
            </property>
            
            <property
                id="yAxis"
                title="y-Axis"
                type="Array">
                <property
                    id="yValues"
                    title="y-Axis Values"
                    type="int"
                />
            </property>
    
    <initialization>
       <defaultValue property="LEFT_MARGIN">5</defaultValue>
       <defaultValue property="TOP_MARGIN">5</defaultValue>
       <defaultValue property="WIDTH">400</defaultValue>
       <defaultValue property="HEIGHT">300</defaultValue>
                
       <defaultValue property="xAxis">[10,20,9,25]</defaultValue>
       <defaultValue property="yAxis">[30,23,15,27]</defaultValue> 
     </initialization>

    Now, I am not getting any error and the component also working in Design Studio. However, the default values are not appearing initially in the property pane.

    Any idea ?

    2pwkt.png (1.3 kB)
  • Get RSS Feed

0 Answers