我使用PrimeFaces。我在客户端上收到错误:SyntaxError: SyntaxError: JSON.parse:JSON数据第1行第26行的预期双引号属性名称 http://localhost:8080/tfoms/javax.faces.resource/jquery/jquery.js.jsf?ln=primefaces&v=5.3 第25行
我的代码:
org_dialog_page.xhtml页面:
<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页面:
<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>
....
删除更新表后发生错误:update =&#34; @widgetVar(orgTreeTable)&#34;
有任何想法为何会发生这种情况吗?
答案 0 :(得分:0)
原因是在treeTable中进行排序
JSON在答案中返回以下行:
{&#34; ValidationFailed&#34;:true,} 在类PrimePartialResponseWriter的PrimeFaces库中,endDocument方法只是形成这一行并添加参数&#39; validationFailed&#39;,而encodeCallbackParams方法就是形成这一行。但在此之前,在课堂上和他的TreeTableRenderer排序方法中,选择键的值为null。因此,只需添加一个空白选项。
查看文档p:treeTable,sortBy中没有属性,但仅在列中。因此,会发生错误。