2
votes

I have found a strange behavior in p:inputMask if it is located inside a row in p:dataTable. It doesn't apply the mask! I have posted a question on the forum, but obtained no answer. I wonder if anybody has met this problem and if there is any workaround for it?

Some code: Doesn't work:

            <p:column header="Order">
                <p:inputMask
                        id="printOrder"
                        required="false"
                        value="#{item.printOrder}"
                        mask="9" />
            </p:column>

But the same code perfectly works outside dataTable. Primefaces 2.0.2.

2
There are some hints here and at Primefaces forum that some components don't work as expected inside a p:dataTable (usual suspects are p:commandLink and p:commandButton). From my experience sometimes it helped to use h:dataTable instead (if thats an option for you since you don't have these nice features of a primefaces dataTable). If it is only for the skin, it's quite easy to let a h:dataTable look like a p:dataTable.Matt Handy

2 Answers

2
votes

You are using an older version of Primefaces that has a number of known issues with component dataTable integration as Matt Handy pointed out.

You can try updating your Primefaces release with either 2.1, 2.2 or 2.2.1 release to see if this issue has been resolved.

http://www.primefaces.org/downloads.html

I couldn't find this as a known issue but this doesn't mean it wasn't fixed with another dataTable fix. For future reference you can refer to known Primefaces issues here.

http://code.google.com/p/primefaces/issues/list

1
votes

I have a datatable defined with columns like this:

<p:column headerText="Mobile Nr." style="width:125px;text-align:center">  
      <p:cellEditor>  
         <f:facet name="output">  
           <h:outputText value="#{user.nrMobile}" />  
         </f:facet>  
         <f:facet name="input">  
            <p:inputMask mask="999999999" value="#{user.nrMobile}" style="width:100%" />  
         </f:facet>  
      </p:cellEditor>  
</p:column>

And works fine. Cheers!