是否可以在p:columns标签中使用p:cellEditor? [英] Is it possible to use p:cellEditor inside a p:columns tag?

查看:626
本文介绍了是否可以在p:columns标签中使用p:cellEditor?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表达式的dataTable,它可以动态地获取它的列,我希望它的单元格可以使用原子cellEditor进行编辑,如show 这里



我试过这样做

 < p:dataTable id =mqTablevalue =#{backingBean.columns}
var =cols>
< p:columns value =#{cols}var =colcolumnIndexVar =colIndex
style =width:10px;>

< h:outputText value =#{cols.get(0).date}rendered =#{colIndex eq 0}>
< f:convertDateTime pattern =#{paramBean.getProperty('format.date','dd / MM / yyyy')}/>
< / h:outputText>
< p:cellEditor>
< f:facet name =output>
< h:outputText value =#{cols.get(colIndex).value}/>
< / f:facet>
< f:facet name =input>
< p:inputText value =#{cols.get(colIndex).value}style =width:30px; />
< / f:facet>

< / p:cellEditor>

< / p:columns>
< / p:dataTable>

但列不显示。



我也希望它从1开始,因为我将使用索引0作为一个不同的目的

解决方案

添加 styleClass =ui-editable-column< p:columns ... styleClass =ui-editable-column>


I have a primefaces dataTable that gets its columns dynamically and I would like its cells to be editable using the primefaces cellEditor as show here.

I tried doing it

<p:dataTable id="mqTable" value="#{backingBean.columns}"
                var="cols">
<p:columns value="#{cols}" var="col" columnIndexVar="colIndex"
                style="width: 10px;">

<h:outputText value="#{cols.get(0).date}" rendered="#{colIndex eq 0}">
        <f:convertDateTime pattern="#{paramBean.getProperty('format.date','dd/MM/yyyy')}"/>
    </h:outputText>
<p:cellEditor>
        <f:facet name="output">
                <h:outputText value="#{cols.get(colIndex).value}" />
        </f:facet>
        <f:facet name="input">
            <p:inputText value="#{cols.get(colIndex).value}" style="width: 30px;" />
        </f:facet>

</p:cellEditor>

</p:columns>
</p:dataTable>

but the columns don't show up.

I also want it to start at 1 because I'll be using index 0 for a different purpose

解决方案

Add styleClass="ui-editable-column" like <p:columns ... styleClass="ui-editable-column" >

这篇关于是否可以在p:columns标签中使用p:cellEditor?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆