2014-01-29 20 views
0

我是JSF的新手。這是我的問題: 我有一個JSF頁面中的表單內的數據表。以前輸入的值會在JSF數據表中消失

 <h:form id="mainForm"> 
     <rich:dataScroller for="itemDataTable" maxPages="30"/>         
     <rich:dataTable rowKeyVar="rkVar" rows="15" id="itemDataTable" value="#{itemsController.itemDM}" var="r"> 
      <h:column id="setValue"> 
       <h:inputText id="finalItem" valueChangeListener="#{itemsController.recalculate()}" value="#{r.items.prices}"/> 
      </h:column> 
      ... 
      ... 
     <!-- other columns --> 
     </rich:dataTable> 
     <rich:dataScroller for="itemDataTable" maxPages="30"/>         
    </h:form> 

我在我的數據表中有大約15頁。我在第一頁輸入了finalItem的最終值,然後單擊下一頁。現在如果我回到第一頁,我發現所有先前輸入的值都從數據表中消失。 請幫助,並請讓我知道如果我缺少數據表中的一些屬性。我也想知道是否有可能從JQuery中處理這個問題。 任何援助將不勝感激!

回答

0

In rich:dataScroller ajaxSingle屬性的默認值爲true。你必須明確地將其弄錯。問題是,你的數據表中的值不被提交,因爲ajaxSingle =「真」

更改您的數據滾動的這樣

 <rich:dataScroller for="itemDataTable" maxPages="30" ajaxSingle="false"/> 

這應該解決您的問題。

請參閱豐富的標籤信息:dataScroller這裏

http://livedemo.exadel.com/richfaces-demo/richfaces/dataTableScroller.jsf?tab=info&cid=574957

RichFaces的4.X

請參閱此鏈接的豐富的屬性:datascroller
http://docs.jboss.org/richfaces/latest_4_X/vdldoc/

您可以使用execute屬性來處理頁面更改中的數據表。

<rich:dataScroller for="itemDataTable" maxPages="30" execute="your datatable id here"/> 
+0

由於「組件dataScroller中未定義屬性ajaxSingle」,我仍然收到錯誤消息。我正在使用richfaces 4.3.4。 – Computergodzilla

+0

用richfaces 4.X更新了答案。希望這可以幫助。 –

0

合併下面一行在你dataScroller

EDITED

<rich:dataScroller for="itemDataTable" maxPages="30" execute="itemDataTable"/> 

而且應該做的伎倆!

+0

這是什麼,我不知道它的庫引用。 – Computergodzilla

+0

a4j m對不起..我剛剛編輯它..我有一種感覺,你可能會感到困惑..只是使用a4j而不是.. –

+0

對不起,a4j沒有,上面的標記顯示錯誤,指示它沒有組件支持。 – Computergodzilla

相關問題