开发者

Why my changes into rich:datatable are not available in my home?

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...


Well,

I were looking for some solution but didnt found a best way... So i solved the problem using a workaround...

<h:selectBooleanCheckbox value="#{cell}" name="presencasHorarios" onclick="setPresencas(#{index},this.checked)"/>

And then i've created a js function like this:

<a4j:jsFunction name="setPresencas" action="#{matrix.addAlteracaoPresenca()}">
            <a4j:actionparam name="param1" assignTo="#{matrix.index}"  />
            <a4j:actionparam name="param2" assignTo="#{matrix.presenca}"  />        
</a4j:jsFunction>

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...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜