Filter on adf Table using view object

2k views Asked by At

I need a filter on my af:table, already tried native adf method filterVisible="true" and by setting filterable="true" but it doesn't return the results on the table. Also tried to do this using manageBean method which, I am going to post below:

jsff page

<af:commandButton text="Filter" id="cb1" actionListener="#
{pageFlowScope.paisMB.filterTableAction}"/>

<af:table value="#{bindings.PaisUVO.collectionModel}" var="row"
              rows="#{bindings.PaisUVO.rangeSize}"
              emptyText="#{bindings.PaisUVO.viewable ? 'No data to display.' : 'Access Denied.'}"
              fetchSize="#{bindings.PaisUVO.rangeSize}"
              rowBandingInterval="0" styleClass="AFStretchWidth"
              selectionListener="#{bindings.PaisUVO.collectionModel.makeCurrent}"
              rowSelection="single" id="t1" binding="#{pageFlowScope.paisMB.tableData}"
              scrollPolicy="page" autoHeightRows="0"
              filterModel="#{bindings.PaisUVOQuery.queryDescriptor}"
              queryListener="#{bindings.PaisUVOQuery.processQuery}" filterVisible="true">
        <af:column sortProperty="#{bindings.PaisUVO.hints.NewsiteOxiLingua.name}"
                    sortable="false"
                    headerText="#{bindings.PaisUVO.hints.NewsiteOxiLingua.label}"
                    id="c6">
            <af:outputText value="#{row.NewsiteOxiLingua}" id="ot3"/>
         </af:column>

         <af:column sortProperty="#{bindings.PaisUVO.hints.NewsiteOxiPaisesPk.name}"
                    sortable="false"
                    headerText="#{bundle['lbl_codigo']}"
                    id="c5">
            <af:outputText value="#{row.NewsiteOxiPaisesPk}" id="ot4">
               <af:convertNumber groupingUsed="false"
                            pattern="#{bindings.PaisUVO.hints.NewsiteOxiPaisesPk.format}"/>
            </af:outputText>
         </af:column>

         <af:column sortProperty="#{bindings.PaisUVO.hints.NewsiteOxiPaisesNome.name}"
                    sortable="false" filterable="true"
                    headerText="#{bundle['lbl_pais']}"
                    id="c7">
            <af:outputText value="#{row.NewsiteOxiPaisesNome}" id="ot2"/>
         </af:column>
</af:table>

I want to filter my last column.Below is my java code for search button.

Manage Bean Page

private transient RichTable tableData;
private RichInputText countryName;
public void filterTableAction(ActionEvent actionEvent) {
    RichTable tb1 = this.getTableData();
    FilterableQueryDescriptor filterQD = (FilterableQueryDescriptor)tb1.getFilterModel();
    Map filterCriteria = filterQD.getFilterCriteria();
    filterCriteria.put("NewsiteOxiPaisesNome", countryName.getValue());
    LOGGER.warning("Filter Criteria : " + filterCriteria);
    getTableData().queueEvent(new QueryEvent(getTableData(), filterQD));
    AdfFacesContext.getCurrentInstance().addPartialTarget(this.getTableData());
    LOGGER.warning("OnFilterTable Action is Called : " + filterQD);
}

My table is based on view object. Can anyone tell me what i am doing wrong. My table simply just dont return search result, also gives no error. If there is anyother better way to do this i am open for suggestions. Version of jdev is 11.1.1.7.0

1

There are 1 answers

0
Samuel Nyong'a On

Under executables in the pageDef.xml file that defines the bindings to this page make sure you have PaisUVOQuery searchRegion. It defines the search region that the filter will use to search. E.g.

"... ..."

set the Binds to the your correct iterator. I had a similar problem and this worked for me.