无法填充使用PrimeFaces从Ajax调用获得的值 [英] Unable to populate values obtained from ajax call using PrimeFaces

查看:78
本文介绍了无法填充使用PrimeFaces从Ajax调用获得的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我使用素数[p:ajax]进行了ajax调用.对该侦听器的调用成功,并且返回了所需的值.为了更新xhtml中的这些属性,我检查了DOM源,以找出列的确切ID,并使用该ID来更新列或属性.但是,在这种情况下,这些字段无法获取值.

Hi
I have made an ajax call using primefaces [p:ajax]. The call to the listener was successful and it returned the required values. To update these properties in xhtml, I have checked the DOM source, to find out the exact ID of the column, using which the column or property would be updated. But, in this case the fields are not getting the values.

我在这种情况下使用的代码是

The code I used in this case is

        <p:dataTable id="table1" var="recepit" rowIndexVar="rowIndex"   value="#{ReceiptDetailsBean.iterativeList}" scrollable="true"  height="120px" styleClass="leftTable">

            <p:column style="background-color: #EFF2F9">
                <f:facet name="header">
                    <h:outputText value="SL NO" />
            </f:facet>
                    <h:outputText value="#{rowIndex+1}" />

            </p:column>

            <p:column >
                <f:facet name="header">
                    <h:outputText value="Buss." />
                </f:facet>

                        <h:selectOneMenu id="selectOneCb" value="#{ReceiptDetailsBean.bussCode}" >
                            <f:selectItem itemLabel="V_BUSS_CODE" itemValue=""/>
                            <f:selectItems value="#{ReceiptDetailsBean.rdetails}" var="model" itemLabel="#{model.buss}" itemValue="#{model.buss}"/>
                             <p:ajax update="mainForm:table1:#{rowIndex}:receiptCode, mainForm:table1:#{rowIndex}:referenceType"  actionListener="#{ReceiptDetailsBean.obtainReceiptDatabasedOnBussCode}" event="change"/>  
                        </h:selectOneMenu>

            </p:column>

            <p:column id="receiptCodeCol">
                <f:facet name="header">
                    <h:outputText value="Receipt Code" />
                </f:facet>

                        <h:inputText value="#{ReceiptDetailsBean.receiptCode}" id="receiptCode" style="font-family: verdana;font-size: 10px;width:80px;height:15px" />


            </p:column>

            <p:column id="receiptTypeCol">
                <f:facet name="header">
                    <h:outputText value="Ref Type" />
                </f:facet>

                        <h:inputText value="#{ReceiptDetailsBean.receiptType}" id="referenceType" style="font-family: verdana;font-size: 10px;width:80px;height:15px"/>


            </p:column>


        </p:dataTable>

                    </div>


        </p:tab>

        <p:tab title="Print">

        </p:tab>



</p:tabView>
</h:form>

来自DOM视图源的ID为table1:0:receiptCodeHotKey:receiptCode

The id from the DOM view source was table1:0:receiptCodeHotKey:receiptCode

没有在字段中填充数据将是什么问题.

What would be the problem for the data to not get populated in the field.

推荐答案

我认为问题的根源是您使用的h:form.您无需将其放在每个单个输入元素周围.将 one h:form放在数据表周围,然后再次检查生成的ID.

I think the source of the problem is your usage of h:form. You don't need to put it around each single input element. Put one h:form around the datatable and then check again the generated ids.

然后应该是这样(例如,行索引为0的第一行的示例):

Then it should be something like (example for first row with rowindex 0):

formId:table1:0:receiptCode

这篇关于无法填充使用PrimeFaces从Ajax调用获得的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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