- <f:facet name="filter">
- <af:selectOneChoice required="#{bindings.Pay0detailVO1.hints.Vsource.mandatory}"
- shortDesc="#{bindings.Pay0detailVO1.hints.Vsource.tooltip}" id="soc41"
- contentStyle="width:100px;" value="#{vs.filterCriteria.Vsource}">
- <f:selectItem itemLabel="" itemValue="" id = "si9"/>
- <f:selectItems value="#{bindings.Vsource.items}" id="si42"/>
- </af:selectOneChoice>
- </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]
- <list IterBinding="Pay0detailVO1Iterator" StaticList="false" Uses="LOV_Vsource" id="Vsource" DTSupportsMRU="true"
- SelectItemValueMode="ListObject" NullValueFlag="start"/>
Users是使用的LOV的名稱 IterBinding是使用哪個table的迭代
頁面定義檔案完成後,就可以在頁面上畫過濾下拉框了,在column域有f:facet name = "filter" 屬性
用法:
[plain]
- <f:facet name="filter">
- <af:selectOneChoice required="#{bindings.Pay0detailVO1.hints.Vsource.mandatory}"
- shortDesc="#{bindings.Pay0detailVO1.hints.Vsource.tooltip}" id="soc41"
- contentStyle="width:100px;" value="#{vs.filterCriteria.Vsource}">
- <f:selectItem itemLabel="" itemValue="" id = "si9"/>
- <f:selectItems value="#{bindings.Vsource.items}" id="si42"/>
- </af:selectOneChoice>
- </f:facet>
這裡value值要綁定到vs.filterCriteria.需要的欄位;
為什麼要有<f:selectItem和<f:selectItems ? 因為 LOV中是UIHintsChoice設定的情況
則會出現過濾地區選取項目好情況,但是回不到當初空白的現象;
so 在f:selectItems前加上f:selectItem且 itemvalue=""
該為實現自訂過濾組件的一個關於下拉框的例子.