Xpages 单选组标签放置

Xpages radio group label placement

看似简单,但我破解不了。我想要的是单选按钮组中每个值的标签,以显示在每个单选按钮上方......用 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>

一种选择是创建自定义渲染器。有关如何为广播组执行此操作的详细信息,请参见此处 comboBox generates a table instead of span in readmode web

用面板和 class "label-above"

围绕您的单选按钮组
<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>

并在您的样式中添加以下条目 sheet:

.label-above {
    height: 35px;
}

.label-above label {
    position: relative;
}

.label-above label input {
    position: absolute;
    top: 15px;
}

这将在单选按钮上方显示标签