当inputText丢失焦点时,cellEditor内的inputText更新表单,我需要在按ENTER键时更新表单
<p:dataTable editable="true" editMode="cell" rowKey="#{invoice.key}"
selection="#{invoiceBB.invoiceSelected}" selectionMode="single"
value="#{invoiceBB.listaDetalleinvoice}" var="invoice">
<p:column>
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{invoice.price}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2"
type="number" />
</h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText
onkeypress="if (event.keyCode == 13) {onchange(); return false;}"
style="width: 500px !important;" value="#{invoice.price}">
<p:ajax event="change"
listener="#{invoiceBB.updatePrice}"
update="@form" />
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
</p:dataTable>
但是如果我将inputText放在dataTable中,当我按下ENTER按钮时它会正确更新表单
<p:inputText
onkeypress="if (event.keyCode == 13) {onchange(); return false;}"
style="width: 500px !important;" value="#{invoice.price}">
<p:ajax event="change"
listener="#{invoiceBB.updatePrice}"
update="@form" />
</p:inputText>
当inputText位于cellEditor内时,是否有修复方法?
答案 0 :(得分:1)
抱歉,我的不好。
{{1}}