0 Replies Latest reply on Dec 23, 2010 8:21 PM by ryneezy

    Filter on Page Load

    ryneezy Newbie

      I'm using the rich:column's filterMethod attribute to invoke a custom filter method. The filter uses a rich:comboBox so a user can select from a list of enumerations.


      It works well.


      The problem I'm having is how do I get the table or column to filter when the page loads?


      For example my enumerated type has:

      • All
      • Selection A
      • Selection B
      • Selection C


      When the page loads, the rich:dataTable displays all the rows bound to the datamodel. If I want the page to display Selection A as the default, how do I get the rich:dataTable or rich:column to sort on Selection A as a default value?


      <rich:dataTable id="mytable" value="#{authorizationList}" var="row">
        <rich:column id="myColumn" filterMethod="#{myBean.filter}">
          <f:facet name="header">
            <h:outputText value="My Column"/><br>
            <rich:comboBox id="myComboBox" value="#{myBean.filterValue}" enableManualInput="false"> 
              <f:selectItems value="#{myBean.filterSelectItems}" />
              <a4j:support event="onchange" focus="myComboBox"/>
          <h:outputText value="row.myProperty"/>


      The value initially bound to myBean.filterValue is "Selection A", but all rows are displayed.