我有ajax功能添加名称并以表格方式在一个图像(文本左侧)和一个“X”图像(右侧删除)上显示在同一页面上。它应该像从左到右一样添加,在完成一行之后,它应该从下一行开始。如何在p:dataGrid中显示字符串的数组列表?
所以我需要在p:datagrid中显示字符串的arraylist或任何其他可用于相同功能的标签。
我尝试过使用ui:repeat和p:panelgrid的组合,但我无法获取datagrid funtionallty。我没有使用p:dataTable,因为它会在底部添加新元素而不是我所需要的。
P.S.
<h:form>
<h:selectOneMenu id="recepients" value="#{controller.selected}">
<f:selectItem itemLabel="Select" itemValue=""></f:selectItem>
<f:selectItem itemLabel="Info1" itemValue="Info1"></f:selectItem>
<f:selectItem itemLabel="Info2" itemValue="Info2"></f:selectItem>
<f:selectItem itemLabel="Info3" itemValue="Info3"></f:selectItem>
<f:selectItem itemLabel="Info4" itemValue="Info4"></f:selectItem>
<f:selectItem itemLabel="Info5" itemValue="Info5"></f:selectItem>
</h:selectOneMenu>
<p:commandButton value="Add" action="#{controller.submit}"
update="nameslist" />
<p:dataGrid id="nameslist" value="#{controller.tempNameList}"
var="name" columns="3">
<p:column>
<p:outputLabel value="%" />
</p:column>
<p:column>
<p:outputLabel value="#{name}" />
</p:column>
<p:column>
<p:commandLink value="X" action="#{controller.delete(name)}"
update="nameslist">
</p:commandLink>
</p:column>
</p:dataGrid>
</h:form>
结果应该是这样的......
%美国广播公司X %的Xyz X %DFD X
PLZ考虑%作为图像和X接近符号
您忘了详细说明您面临的错误/问题。你究竟如何无法使其工作? – BalusC 2013-02-14 12:57:53
请分享您的部分代码。它不会伤害:) – 2013-02-14 19:31:49
@BalusC点击后添加按钮名称,它应该以表格的形式显示在屏幕上。 Primefaces的DataGrid提供了这个解决方案。但在我的情况下,它不接受字符串的数组列表 – 2013-02-15 12:40:27