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

  1. Hi Jobinesh,

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

    Thanks
    Kareem

    ReplyDelete
  2. 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

    ReplyDelete
  3. Hi Jobinesh,

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

    Thanks,
    Kareem

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. 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

    ReplyDelete

Post a Comment