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

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of my employer.