2014-02-12 25 views
0

我已經使用Myfaces 2.1.12和Richfaces 4.3.3創建了一個JSF應用程序。在普通的瀏覽器上,應用程序可以正常工作,但客戶堅稱他還需要使用「瀏覽器」 - IE8版本8.0.7601。我有一堆問題。動態呈現的彈出式面板上的Rich:commandLink和rich:commandButton在IE 8中無效

我在主窗體上有一個rich:extendedDataTable。點擊一行將打開一個包含細節的彈出窗口(用選定行中的數據進行渲染和填充)。彈出窗口也可以從工具欄中調用,這樣可以顯示首次加載頁面時選擇的行的詳細信息。

該表(列定義爲清楚起見移除)

<h:form> 
    <rich:extendedDataTable id="table" rowClass="row" rows="15" 
     value="#{scheduleController.allSchedules}" var="schedule" selectionMode="single" 
     selection="#{scheduleListBean.selectedSchedule.selection}" clientRows="15"> 
     <a4j:ajax render="scheduleDetails, toolbar, transferListPopup" event="selectionchange" 
      listener="#{scheduleController.scheduleSelectionChanged}" 
      oncomplete="#{rich:component('scheduleDetailsPopup')}.show()"/> 

     ... 
    </rich:extendedDataTable> 
</h:form> 

彈出包含了兩個面板網格的定義如下,至極之一含有一些按鈕。

<h:panelGrid columns="2" styleClass="alignTop" id="scheduleDetails"> 
    ... 

    <rich:panel header="#{generalProperties.controls}"> 
     <h:panelGrid columns="4"> 

      <a4j:commandLink styleClass="btn" type="button" 
       render="[email protected], transferDetailsPanel, destinationPanel, datesPanel" 
       oncomplete="if (#{facesContext.maximumSeverity == null}) #{rich:component('scheduleDetailsPopup')}.hide()" 
       status="pleaseWait" action="#{scheduleController.saveSchedule}" 
       value="#{generalProperties.save}" /> 


      <h:commandButton class="btn" action="#{scheduleController.changeScheduleStatus}" 
       value="#{applicationProperties.changeStatus}" status="pleaseWait" type="button" 
       disabled="#{scheduleController.currentSchedule.id == null}"> 
       <rich:componentControl target="changeScheduleStatusPopup" operation="show" /> 
      </h:commandButton> 

      <h:commandButton class="btn" value="#{generalProperties.delete}" status="pleaseWait" type="button" 
       disabled="#{scheduleController.currentSchedule.id == null}"> 
       <rich:componentControl target="removeSchedulePopup" operation="show" /> 
      </h:commandButton> 

      <a4j:commandButton styleClass="btn" type="button" 
       render="fileTable, transferDetailsPanel, destinationPanel, datesPanel" 
       disabled="#{scheduleController.currentSchedule.id == null}" 
       oncomplete="if (#{facesContext.maximumSeverity == null}) #{rich:component('transferListPopup')}.show()" 
       status="pleaseWait" value="#{applicationProperties.transferHistory}" /> 

     </h:panelGrid> 
    </rich:panel> 

</h:panelGrid> 

殘疾人=「#{scheduleController.currentSchedule.id == NULL}」如果選擇任何內容作爲彈出也用於添加新行部分檢查豆。

一切工作正常在Firefox上。在IE8:

  • 點擊commandLink不起作用(什麼也沒有發生,除了一個「#」 追加到的URL在瀏覽器中)時,彈出從 擴展數據表(渲染)呼籲,但在從 工具欄調用它時起作用。
  • 當從擴展數據表(渲染)調用彈出窗口時,單擊commandButton不起作用(頁面被重新加載而不是ajax請求正在執行),但在從 工具欄調用它時起作用。
  • ,如果我從命令按鈕刪除type =「按鈕」,然後單擊它們會導致整個頁面重新加載

我缺少什麼?

+0

RichFaces 4.x在「正常」模式下無法在IE 8和IE 9中運行。試着用元標記'。參見[其他相關問題](http://stackoverflow.com/questions/20799156/ajax-scritps-dont-work-in-ie/20808562#20808562)。 –

回答

0

答案在於問題本身。我重建了UI,以便在Ajax請求中不渲染任何按鈕。這樣它就可以在IE 8和IE 9上運行。

即:不是基於bean設置disabled屬性,而是渲染按鈕,我不得不使用每個按鈕的兩個實例。我通過使用composite:insertChildren將表單提取到複合​​組件中來實現這一點,只是爲了在適當的狀態下插入按鈕並在頁面上有兩個表單實例,當用戶單擊新的計劃/編輯計劃時顯示正確的一個。

這種方法的缺點是我必須將顯示彈出窗口的組件的渲染屬性設置爲不同於形式的東西(在本例中爲 - 面板),如果我使用了Mojarra,這將是一個問題(請參閱此問題:javax.faces.ViewState is missing after ajax render