Skip to main content

Enabling Validation for Table Filters

You can enable filtering for UI Tables without much effort while building the web pages using ADF Faces. Please refer Enabling Filtering in Tables in Web User Interface Developer's Guide to know more about this topic.

By design, the input validators are turned off to allow for entering characters for operators such as > and < to modify the search criteria. However, you are free to override the default filter fields by using the filter facet for the <af:column>. You can provide your own components for filter fields using the filter facet, and add converter/validator of your choice to these fields.

Please see the below jspx snippet. Run-time renders the components specified inside the 'filter' facet for the filter displayed on top of EmployeeId column.
  <af:table value="#{bindings.EmployeesView1.collectionModel}" var="row"
                  rows="#{bindings.EmployeesView1.rangeSize}"
                  fetchSize="#{bindings.EmployeesView1.rangeSize}"
                  rowBandingInterval="0"
                  filterModel="#{bindings.EmployeesView1Query.queryDescriptor}"
                  queryListener="#{bindings.EmployeesView1Query.processQuery}"
                  filterVisible="true" varStatus="vs" id="t1">
  <af:column sortProperty="EmployeeId" filterable="true"
         sortable="false"
         headerText="#{bindings.EmployeesView1.hints.EmployeeId.label}"
         id="c5">
    <af:inputText value="#{row.bindings.EmployeeId.inputValue}"
          label="#{bindings.EmployeesView1.hints.EmployeeId.label}"
          required="#{bindings.EmployeesView1.hints.EmployeeId.mandatory}"
          columns="#{bindings.EmployeesView1.hints.EmployeeId.displayWidth}"
          maximumLength="#{bindings.EmployeesView1.hints.EmployeeId.precision}"
          shortDesc="#{bindings.EmployeesView1.hints.EmployeeId.tooltip}"
          id="it8">
      <f:validator binding="#{row.bindings.EmployeeId.validator}"/>
      <af:convertNumber groupingUsed="false"
            pattern="#{bindings.EmployeesView1.hints.EmployeeId.format}"/>
    </af:inputText>
   <f:facet name="filter">
     <af:inputText value="#{vs.filterCriteria.EmployeeId}" id="id31"
               label=" ">
       <af:convertNumber groupingUsed="false"
                 pattern="#{bindings.EmployeesView1.hints.EmployeeId.format}"/>
     </af:inputText>
    </f:facet>
  </af:column> 
          ....
  </af:table>

Comments

Anonymous said…
Hi Jobinesh,

Do you have an idea on how to programmatically get accesses to selected columns from a adf rich table ?

Thanks
Kareem
Jobinesh said…
Kareem,
AFAIK, there is not declarative support for this. However you can do this programatically.
1. Write down af:clientListener for the cell's editable component
2. From the clientListener, invoke server side method using af:serverListener. You can pass the row,column info along with payload to server
Anonymous said…
Hi Jobinesh,

Sounds to be a good idea. I will try out and let you know.

Thanks,
Kareem
Srikanth said…
This comment has been removed by the author.
Srikanth said…
Hi Jobinesh,

Can we get QBE filters for tables formed without VO binding.

Tables formed using

<af:table value="#{pageFlowScope.appController.tableModel}" rows="#{pageFlowScope.appController.tableModel.rowCount}"

columns formed using forEach loop.

Thanks,
Srikanth

Popular posts from this blog

How to set Bind Variable Values at runtime ?

In this post I'm sharing a couple of approaches for programmatically setting bind variables values at run time. This post is an attempt to explain 'When to use what ?'[ In case if you are familiar with 'Bind Variables' in ADF BC, please refer Section 5.10, Working with Bind Variables in Fusion Developer's Guide ]

1. Set the Bind Variable value using RowSet::setNamedWhereClauseParam(...)

You can use use the setNamedWhereClauseParam(...) method on the ViewObject interface (which extends oracle.jbo.RowSet) to set the value for bind variables. Please note this sets the value on default RowSet. In other words, this doesn't have any effect on the secondary RowSets that you/system generates.
ViewObject vo = am.findViewObject("EmployeesView1"); vo.setNamedWhereClauseParam("bindVarDeptId", new Number(10)); vo.executeQuery();
2. Set the Bind Variable value using ViewObject's VariableValueManager::setVariableValue(...)

VariableValueManager Ma…

Happy New Year 2018 !

We can't go back and change the beginning, but we always can start where we are and change the ending. Believe in yourself and you will be unstoppable!

Wishing you and your family a very happy new year 2018 !!!