似乎这么简单,但我无法破解它。我想要的只是一个单选按钮组中每个值的标签,显示在每个单选按钮上方.....尝试了一些CSS但没有雪茄的东西,所以任何指针都会受到赞赏。
我在自定义控件中使用复合数据对象传递值
<xc:ccQuestionInterimRadios required="true"
dataSource="#{document1}" fieldName="test"
helpText="Please select an answer"
placeholder="Enter any further details here..."
questionHeader="primary" questionTextNJD="QuestionTextNJD"
questionText="Question text goes here">
<xc:this.radioOptions><![CDATA[#{javascript:return ['1', '2', '3', '4', '5'];}]]></xc:this.radioOptions>
</xc:ccQuestionInterimRadios>
值传递为:
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:compositeData.radioOptions}]]></xp:this.value>
</xp:selectItems>
输出的HTML是:
<label for="view:_id1:_id2:_id45:_id46:radioGroupOptions:0">
<input type="radio" id="view:_id1:_id2:_id45:_id46:radioGroupOptions:0" name="view:_id1:_id2:_id45:_id46:radioGroupOptions" value="1">
1
</label>
用一个面板和一个“标签在上面”的类别环绕您的单选按钮组
<xp:panel
styleClass="label-above">
<xp:radioGroup
id="radioGroup1"
value="#{sessionScope.test}">
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:["aaa", "bbb", "ccc"]}]]></xp:this.value>
</xp:selectItems>
</xp:radioGroup>
</xp:panel>
并在样式表中添加以下条目:
.label-above {
height: 35px;
}
.label-above label {
position: relative;
}
.label-above label input {
position: absolute;
top: 15px;
}
这将显示单选按钮上方的标签
一种选择是创建自定义渲染器。有关如何为无线电组执行此操作的详细信息,请访问comboBox generates a table instead of span in readmode web