2012-06-17 67 views
1

我不知道我是否在正確的軌道上還是不在問這個問題。JSF:避免嵌套更新調用

我我的JSF項目我有這樣的樹形結構:

<p:tree id="resourcesTree" value="#{someBean.root}" var="node" selectionMode="single" styleClass="no-border" 
    selection="#{someBean.selectedNode}" dynamic="true"> 
    <p:ajax listener="#{someBean.onNodeSelect}" update=":centerPanel :tableForm :tabForm" event="select" onstart="statusDialog.show();" 
     oncomplete="statusDialog.hide();" /> 
    <p:treeNode id="resourcesTreeNode" > 
     <h:outputText value="#{node}" id="lblNode" /> 
    </p:treeNode> 
</p:tree> 

我要更新這棵樹後,我補上一或刪除東西..但每當我更新這仍然是其嵌套更新還叫我的意思說這也叫更新這些組件「:centerPanel:tableForm:tabForm」 ......

這給我的錯誤:tableForm鑑於沒有發現,因爲這形成負載在我中心面板,這棵樹是我的右側面板..所以當我在做一些樹的操作是不是總是:tableForm是我的中央面板..(我是指設計是這樣的只)

所以現在我的問題是,我可以把一些條件或者有什麼辦法讓我可以指定同時更新嵌套組件以及何時不....在堅果殼有什麼辦法只更新:resoucesTree是這樣一種方式,嵌套更新不叫,這樣我可以避免錯誤...

在此先感謝。

回答

1

您可以在update屬性中使用EL。

update=":centerPanel :tabForm #{hasTableForm ? ':tableForm' : ''}" 

其中虛擬#{hasTableForm}返回一個布爾值。

但是,如果:tableForm已在:centerPanel之內,那麼您可以省略它。

update=":centerPanel :tabForm"