为什么我对 rich:datatable 的更改在我的家里不可用?
我有一个丰富的:带有动态列的数据表...直到这里还可以...我从数据库中获取所有数据,我的代码显示了具有正确值的所有复选框...但是当我更改它们并单击“salvar”时按钮另一侧的值仍然与以前相同... 但是,如果我将 inputText 放在 rich:Datatable 之外,例如
<h:inputText value="#{matrix.teste}"/>
并放置任何值,然后单击“salvar”,我之前输入的值会正确地转到我的家...
<ui:param name="matrix" value="#{inscricaoMatrix}" />
<a4j:outputPanel id="matrixCredenciamento">
<a4j:form>
<rich:dataTable value="#{matrix.rows}" var="row" id="matrix" rendered="#{not empty query.inscricoes}">
<rich:column label="Nome">
<f:facet name="header">
<h:outputText value="Nome" />
</f:facet>
<h:outputText value="#{row.nome}" />
</rich:column>
<rich:column label="E-mail">
<f:facet name="header">
<h:outputText value="E-mail" />
</f:facet>
<h:outputText value="#{row.email}" />
</rich:column>
<rich:column label="Credenciamento">
<f:facet name="header">
<h:outputText value="Credenciamento" />
</f:facet>
<h:selectBooleanCheckbox value="#{row.credenciamento}" />
</rich:column>
<ui:param name="y" value="#{matrix.rows.indexOf(row)}" />
<rich:columns value="#{matrix.columns}" var="col" index="x" style="text-align: center; width: 60px;">
<ui:param name="index" value="#{y * matrix.columns.size() + x}" />
<ui:param name="cell" value="#{matrix.cells[index]}" />
<f:facet name="header">
<h:outputText value="#{col.horario}" escape="true">
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
</h:outputText>
</f:facet>
<h:selectBooleanCheckbox value="#{cell}" />
</rich:columns>
</rich:dataTable>
<h:inputText value="#{matrix.teste}"/>
<h:commandButton id="salvar" value="Salvar" action="#{matrix.update()}" />
</a4j:form>
</a4j:outputPanel>
</ui:composition>
有人知道可能是什么问题吗?我正在将该页面添加到另一个页面(使用 ui:include)来添加此页面...
I have a rich:Datatable with dynamic columns... Till here its ok... I get all data from the database and my code shows all checkboxs with the correctly values... But when i change them and click in "salvar" button the values in the other side still the same as before...
But if i put an inputText outside rich:Datatable like
<h:inputText value="#{matrix.teste}"/>
And put any value, and click in "salvar" the value i've typed before goes to my home correctly...
<ui:param name="matrix" value="#{inscricaoMatrix}" />
<a4j:outputPanel id="matrixCredenciamento">
<a4j:form>
<rich:dataTable value="#{matrix.rows}" var="row" id="matrix" rendered="#{not empty query.inscricoes}">
<rich:column label="Nome">
<f:facet name="header">
<h:outputText value="Nome" />
</f:facet>
<h:outputText value="#{row.nome}" />
</rich:column>
<rich:column label="E-mail">
<f:facet name="header">
<h:outputText value="E-mail" />
</f:facet>
<h:outputText value="#{row.email}" />
</rich:column>
<rich:column label="Credenciamento">
<f:facet name="header">
<h:outputText value="Credenciamento" />
</f:facet>
<h:selectBooleanCheckbox value="#{row.credenciamento}" />
</rich:column>
<ui:param name="y" value="#{matrix.rows.indexOf(row)}" />
<rich:columns value="#{matrix.columns}" var="col" index="x" style="text-align: center; width: 60px;">
<ui:param name="index" value="#{y * matrix.columns.size() + x}" />
<ui:param name="cell" value="#{matrix.cells[index]}" />
<f:facet name="header">
<h:outputText value="#{col.horario}" escape="true">
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
</h:outputText>
</f:facet>
<h:selectBooleanCheckbox value="#{cell}" />
</rich:columns>
</rich:dataTable>
<h:inputText value="#{matrix.teste}"/>
<h:commandButton id="salvar" value="Salvar" action="#{matrix.update()}" />
</a4j:form>
</a4j:outputPanel>
</ui:composition>
Someone knows what can be the problem? Im working with that page into another (using ui:include) to add this page...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,
我一直在寻找一些解决方案,但没有找到最好的方法......
所以我使用解决方法解决了这个问题...
然后我创建了一个像这样的js函数:
在另一边我创建了一个列表...所以我传递了数组的索引和新值项目...当我提交它以保留或更新时,我会读取该列表,验证哪个项目已更改以及它的新值...为了更容易,我创建了一个传递索引和值的 HashMap...因此,如果用户更改该值 1000 次,该值将永远是最后一个 一...
Well,
I were looking for some solution but didnt found a best way...
So i solved the problem using a workaround...
And then i've created a js function like this:
In the other side i've created a list... so i pass the index of the array and the new value for this item... When i submit it to persist or update i read that list verifying which item has been changed and the new value of it... To get it easier i've created a HashMap passing the index and the value... so if the user change the value 1000 times, the value will be ever the last one...