简体   繁体   中英

Primefaces. Error on client: JSON.parse: expected double-quoted property name at line 1 column 26 of the JSON data

I use PrimeFaces. And i get error on client: SyntaxError: SyntaxError: JSON.parse: expected double-quoted property name at line 1 column 26 of the JSON data http://localhost:8080/tfoms/javax.faces.resource/jquery/jquery.js.jsf?ln=primefaces&v=5.3 Line 25

My code:

org_dialog_page.xhtml page:

<h:form id="orgDetail">
<p:tabView id="orgTabView" widgetVar="orgDetailTabView" style="height: 500px" activeIndex="#{organizationBean.activeIndex}" >
    <p:tab title="General">
        <p:panelGrid id="orgDetails" columns="12" styleClass="full-width ui-org-details"
                                     columnClasses="label,value,validation_icon,label,value,validation_icon,label,value,validation_icon,label,value,validation_icon">
            <h:outputText value="INN:"/>
            <p:inputText id="innIndividual" widgetVar="innIndividual" style="width: 85px"
                         value="#{organizationBean.selectedOrganization.inn}"
                         rendered="#{organizationBean.selectedOrganization.regTypeName eq 'INDIVIDUAL'}"
                         validatorMessage="message">
                <f:validateRegex pattern="^([0]{1}|[0-9]{12})$"/>
                <p:clientValidator event="keyup"/>
                <p:ajax event="blur" process="@this"/>
            </p:inputText>
            <p:message rendered="#{organizationBean.selectedOrganization.regTypeName eq 'INDIVIDUAL'}"
                       for="innIndividual" display="icon"/>
            <p:inputText id="innLegal" widgetVar="innLegal" style="width: 85px"
                         value="#{organizationBean.selectedOrganization.inn}"
                         rendered="#{organizationBean.selectedOrganization.regTypeName ne 'INDIVIDUAL'}"
                         disabled="#{organizationBean.selectedOrganization.regTypeName eq 'NONE'}"
                         validatorMessage="message">
                <f:validateRegex pattern="^[0-9]{10}$"/>
                <p:clientValidator event="keyup"/>
                <p:ajax event="blur" process="@this"/>
            </p:inputText>

            ..........

        </p:panelGrid>
    </p:tab>    

</p:tabView>
<br/>
<p:commandButton rendered="#{securityBean.canUpdate(organizationBean.dictionaryClass)}"
                 value="Save" actionListener="#{organizationBean.save}" action="#{organizationCacheBean.reload}"
                 process="@form"  update="@widgetVar(orgTreeTable)"
                 oncomplete="autoScroll('.ui-organization-dict')"/>

org.xhtml page:

<p:treeTable value="#{organizationBean.rootNode}" var="organization" style="margin-top:0"
         styleClass="ui-scroll-treetable-70vh ui-organization-dict" selectionMode="single"
         selection="#{organizationBean.selectedNode}" widgetVar="orgTreeTable" id="orgTreeTable"
         emptyMessage="message" scrollable="true" scrollHeight="500" sortBy="#{organization.shortName}">
<p:ajax event="select" listener="#{organizationBean.onOrganizationSelect}" process="@this"
        update="@(.ui-organizations-toolbar)"/>
<p:column headerText="Name" style="width: 55%">
    <f:facet name="header">
        <h:outputText value="name"/> <br/>
        <p:inputText value="#{organizationBean.shortNameFilter}" size="30"
                     onkeypress="if (event.keyCode == 13) { filterOrgTree(); return false; }"/>
    </f:facet>
    <h:outputText value="#{organization.shortName}"/>
</p:column>

....

It error left after remove update table : update="@widgetVar(orgTreeTable)"

Have any ideas why this is happening?

Reason is sorting in treeTable

JSON return here the following line in the answer:

{ "ValidationFailed": true,} In class PrimePartialResponseWriter PrimeFaces library, endDocument method just is the formation of this line and add the parameter 'validationFailed', and encodeCallbackParams method is the formation of this line. But before that, in the classroom and in his TreeTableRenderer sort method selection key is added with the value null. Because of this, just add a blank option.

Looking documentation p: treeTable, sortBy no properties in the treeTable, but only in the column. Because of this, and an error occurs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM