2012-08-16 2 views
0

저는 primefaces 3.3을 JSF 2.1과 함께 사용하고 있습니다. 아래 코드에서, 내 페이지의 왼쪽 부분에 트리 구성 요소에서 올바르게 활성화 된 데이터베이스에서 가져온 데이터 행을 포함하는 primeFaces dataTable이 있습니다. dataTable이 올바르게 표시되고 올바르게 작동합니다. 내 dataTable을 새로 고치고 데이터베이스가 업데이트 된 후 변경 사항을 반영하는 "update"를 호출하는 삭제 기능이 있습니다. 내 문제는 f : facet (id = "header")와 함께 있습니다. 그 패싯에는 내 dataTable에 새로운 행을 만드는 commandLink가 들어 있습니다. 그것은 내 데이터베이스가 올바르게 업데이트된다는 의미에서 작동합니다. 이 후에는 dataTable이 새로 고쳐지지 않습니다. 내 dataTable을 새로 고치려면 트리 구성 요소의 다른 노드 (페이지 왼쪽에 있음)를 클릭 한 다음 원래 treeNode로 돌아가서 내 dataTable이 완벽하게 업데이트되었는지 확인해야합니다. dataTable을 동적으로 업데이트하려면 코드에 무엇을 추가 할 수 있습니까? 불행히도, 여기에서 시도한 모든 순열을 추가 할 수는 없습니다.이 문제에 대해 오랜 시간을 보냈습니다. 입력 한 내용을 매우 높이 평가할 것입니다!면 내에서 업데이트 할 수 없습니다

<h:form id="formRight" >    
    <p:dataTable var="material" value="#{entityCrudTreeBean.materialList}" id="materials" editable="true" paginator="true" rows="10" sortBy="#{material.name}"> 
       <p:ajax event="rowEdit" listener="#{entityCrudTreeBean.onEditRow}"/> 
       <f:facet id="header" name="header"> 
        In-Cell Material Editing 
        <br /> 
        <p:commandLink id="create" value="Add new material" action="#{entityCrudTreeBean.createNewMaterial}" update=":formRight"/> 
       </f:facet> 
       <p:column headerText="Name" style="width:125px"> 
        <p:cellEditor> 
         ... 
        </p:cellEditor> 
       </p:column> 

       <p:column headerText="Options" style="width:10px" > 
        <p:rowEditor /> 
        <p:commandLink id="delete" action="#{entityCrudTreeBean.deleteRow(material)}" update=":formRight"> 
         <h:graphicImage value="#{resource['icons:Delete-icon.png']}" /> 
        </p:commandLink> 
       </p:column> 
      </p:dataTable> 
    </h:form> 

편집 : 중 하나 편집이 작동하지 않습니다 <p:commandLink id="create" value="Add new material" action="#{entityCrudTreeBean.createNewMaterial}" update=":formRight:materials"/> 에 라인 변경 : 하나 문제가 해결되지 <f:facet id="header" name="header"> In-Cell Material Editing <br /> <p:commandLink id="create" value="Add new material" ajax="true" process="@this" action="#{entityCrudTreeBean.createNewMaterial}" update="@form"/> </f:facet> :로 변경 합니다.

+0

전체 질문 (제목 만)을 읽지 않았습니다 ... 'update = ": formRight"를'update = "@ form"' – Daniel

+0

으로 바꿔보십시오. Daniel. 불행히도,'code :

'도 작동하지 않는다 – Rick

+0

' '다른 형태로 싸여 있습니까? – Daniel

답변

0

스티븐, 당신이 올바른 궤도에있어 : ​​

내 작업 코드는 같다! 더 간단한 방법으로 해결되었습니다. 관리 빈에서 내 dataTable 목록을 업데이트했습니다. 삭제를 위해했으나 삽입은 수행하지 않았습니다. 거기에 대규모 감시. 이 코드는 작동합니다 : <p:commandLink id="create" value="Add new material" action="#{entityCrudTreeBean.createNewMaterial}" update=":formRight"/> 나를위한 팁 : Primefaces 3.3은 dataTable에서 업데이트하는 것과 관련된 알려진 문제점이 있습니다. dataTable을 양식의 레이아웃과 같은 다른 구성 요소로 래핑해야합니다. 래퍼에서 업데이트를 호출하면 작동합니다. 8 월 15 일의 primefaces 블로그에 따르면, 이것은 3.4.RC1에서 수정되었습니다. 그러나 그들은 나무 구성 요소를 변경했습니다. 업그레이드하기 전에 3.4 최종 출시를 기다릴 것입니다.

2

나는 잠시 동안 당신과 비슷한 문제가있었습니다.

<f:facet name="header">Product List 
<p:commandLink id="create" value="Add new product" ajax="true" process="@this" 
action="#{modelBean.save}" update="@form"/> 
</f:facet> 
+0

안녕하세요. Stephen, 코드 공유에 감사드립니다.셀 내 소재 편집

Rick

+0

어쩌면 여기에 어리석은 짓일 수도 있습니다. 문제는 아마도 다른 곳에 있으며 xhtml에 있지 않을 수도 있습니다. entityCrudTreeBean과 전체 xhtml 페이지를 게시 할 수 있습니까? – StephenMeyer

관련 문제