Oracle ADF table列自訂過濾組件的方法

來源:互聯網
上載者:User

  1. <f:facet name="filter">  
  2.                       <af:selectOneChoice required="#{bindings.Pay0detailVO1.hints.Vsource.mandatory}"  
  3.                                           shortDesc="#{bindings.Pay0detailVO1.hints.Vsource.tooltip}" id="soc41"  
  4.                                           contentStyle="width:100px;" value="#{vs.filterCriteria.Vsource}">  
  5.                          <f:selectItem itemLabel="" itemValue="" id = "si9"/>   
  6.                         <f:selectItems value="#{bindings.Vsource.items}" id="si42"/>  
  7.                       </af:selectOneChoice>  
  8.                     </f:facet>  
正常拖拽過來的af:table組件的過濾行的查詢地區只是文本輸入欄位.

:,

但是如果設計要求是在建立行上進行編輯的話,如果某些列是搜尋協助或下拉框的形式,在過濾地區進行文本過濾則得不到想要的結果

:

在過濾結算方向碼列時 單純輸入支付增加則過濾不出想要的結果.因為 每一行的資料都是來自資料庫中的字典項.

並且,本列儲存的值是字典項代碼,而在UI上顯示的是字典項名稱.所以 在過濾時其實是輸入01 02 03這樣的資料字典代碼才能得到想要的結果

但是使用者不會知道字典代碼.所以現在要實現如的效果


則在過濾地區進行下拉框讀取資料庫字典項來篩選能滿足需求.

操作方法如下:進入頁面的pagedefine.xml

新增一個下拉框List:


選擇第二項select one value list that update a base data source


之後選擇model driven  List找到該欄位的LOV

在XML產生的程式碼如下 ,熟練的話以後直接COPY就行

[html]
  1. <list IterBinding="Pay0detailVO1Iterator" StaticList="false" Uses="LOV_Vsource" id="Vsource" DTSupportsMRU="true"  
  2.           SelectItemValueMode="ListObject" NullValueFlag="start"/>  
Users是使用的LOV的名稱 IterBinding是使用哪個table的迭代

頁面定義檔案完成後,就可以在頁面上畫過濾下拉框了,在column域有f:facet name = "filter" 屬性

用法:

[plain]

  1. <f:facet name="filter">  
  2.                       <af:selectOneChoice required="#{bindings.Pay0detailVO1.hints.Vsource.mandatory}"  
  3.                                           shortDesc="#{bindings.Pay0detailVO1.hints.Vsource.tooltip}" id="soc41"  
  4.                                           contentStyle="width:100px;" value="#{vs.filterCriteria.Vsource}">  
  5.                          <f:selectItem itemLabel="" itemValue="" id = "si9"/>   
  6.                         <f:selectItems value="#{bindings.Vsource.items}" id="si42"/>  
  7.                       </af:selectOneChoice>  
  8.                     </f:facet>  
這裡value值要綁定到vs.filterCriteria.需要的欄位;

為什麼要有<f:selectItem和<f:selectItems  ? 因為 LOV中是UIHintsChoice設定的情況

則會出現過濾地區選取項目好情況,但是回不到當初空白的現象;

so 在f:selectItems前加上f:selectItem且 itemvalue=""

該為實現自訂過濾組件的一個關於下拉框的例子.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.