我需要显示<p:selectManyCheckbox>
带有图像的项目。我试图用 in 显示图像<p:selectOneRadio>
。它工作正常。我正在以编程方式在 UI 上添加组件。这是我的代码。
answerRadio.setLayout("custom"); //answerRadio is SelectOneRadio
customPnl = (PanelGrid) app.createComponent(PanelGrid.COMPONENT_TYPE);
customPnl.setId("pnl"+qstnCnt);
customPnl.setColumns(3);
radioBtn = (RadioButton) app.createComponent(RadioButton.COMPONENT_TYPE);
radioBtn.setId("opt"+qstnAnsIndx);
radioBtn.setFor("ID of answerRadio");
radioBtn.setItemIndex(ansIndx);
customPnl.getChildren().add(radioBtn);
outPnl.getChildren().add(answerRadio); //outPnl is OutputPanel that include answerRadio
outPnl.getChildren().add(customPnl);
那是<p:selectOneRadio>
图像。
我想以<p:selectManyCheckbox>
同样的方式使用。但是 PrimeFaces 只有一个<p:radioButton>
自定义布局,而不是<p:checkbox>
类似的。无论如何,我怎样才能实现它?如何显示<p:selectManyCheckbox>
带有图像的项目?