使用ajax时无法呈现JSF网格

时间:2013-12-19 16:19:44

标签: jsf primefaces

我使用Primefaces来实现树和网格。单击树时,网格将根据节点更改。现在,java可以接受树节点id,并且所有数据都可以保存在列表中。但网格数据无法改变。有人对此有所了解吗?感谢。

<p:layoutUnit id="layoutunitleft" position="west" size="360"  resizable="true" collapsible="true" header="Options" minSize="260">
<p:accordionPanel id="accordingpanel1">                         
 <p:tab id="accordingpanel1tab" title="Project">                             
      <!-- <ui:include src="tree.xhtml" />     -->  

  <!--      <h:form id="form">   -->
  <p:tree value="#{treeBean.root}" var="node" id="tree"   dynamic="true" cache="false" selectionMode="single"  selection="#{treeBean.selectedNode}">

    <p:ajax event="expand"  listener="#{treeBean.onNodeExpand}"/>  
    <p:ajax event="collapse"  listener="#{treeBean.onNodeCollapse}" />
    <p:ajax event="select" process=":mainForm:scenarioDetailTable"  listener="#{tableBean.showScenario}" />         
    <p:ajax event="unselect"  listener="#{treeBean.onNodeUnselect}" /> 
    <p:treeNode id="treeNode" expandedIcon="ui-icon-folder-open" collapsedIcon="ui-icon-folder-collapsed">  
        <h:outputText value="#{node.name}" id="lblNode"/>  
    </p:treeNode>  
</p:tree>     
<!--    </h:form>  -->

 </p:tab>                          
 <p:tab title="Testset">                             
   <h:outputText value="Testset" />                         
 </p:tab>                          
 <p:tab title="Report">                             
  <!--   <h:outputText value="Report" />  -->
   <p:calendar mode="inline" navigator="none"/>                         
 </p:tab>                     
 </p:accordionPanel>                 
</p:layoutUnit>


<!-- grid start --> 
<p:layoutUnit id="layoutunitnorthcenter" position="center" resizable="true" layout="block">            

     <p:dataTable id="scenarioDetailTable" var="scenariob" value="#{tableBean.scenarioDetail}" ajaxRendered="true" >        

        <p:column style="width:20px">  
            <h:outputText id="dragIcon"  
                styleClass="ui-icon ui-icon-arrow-4" />  
            <p:draggable for="dragIcon" revert="true" />  
        </p:column>

        <p:column headerText="ScenarioName">  
           <h:outputText value="#{scenariob.name}" />  
        </p:column>  

        <p:column headerText="Description">  
            <h:outputText value="#{scenariob.description}" size="20"/> 
        </p:column>  

       <p:column headerText="Status">  
           <h:outputText value="#{scenariob.scenarioStatusId}" />  
       </p:column>  

       <p:column headerText="Meta">  
           <h:outputText value="#{scenariob.meta}" /> 
       </p:column>  

       <p:column headerText="Scenario"> 
         <p:graphicImage id="img1" value="/images/logo/images.png"  width="20px" height="20px" style="cursor:pointer" title="Create"/>             
       </p:column>

       <p:column headerText="Step">  
        <h:outputText id="stepIcon"  
                styleClass="ui-icon ui-icon-disk" />  
            <p:draggable for="stepIcon" revert="true" /> 
       </p:column>
     </p:dataTable>                      
 </p:layoutUnit>

</p:layout>
</p:layoutUnit>           

1 个答案:

答案 0 :(得分:0)

尝试以下方法..

<p:ajax event="select" 
        update=":mainForm:scenarioDetailTable"  
        listener="#{tableBean.showScenario}" />