0
votes

I have a strange issue. I have a search criteria and i have a datatable which displays the results.

The search functionality works fine. Below is the issue.

I enter some search criteria i click on search button the records get displayed. Fine. Again i enter some search criteria for which there are no records the datatable should get cleared.But the issue is the old record itself is getting displayed. What can be the problem

Below is my java code:

public void results(TestItem[] TestItemTOArray, TestForm TestForm, boolean isNewSearch, CarService carService) throws Exception {
        if (viewBean instanceof TestViewBean) {
            TestViewBean = (TestViewBean) viewBean;
        }
        TestRowForm[] TestRowFormArray = this.convertToTestRowForm(TestItemTOArray, TestForm, isNewSearch, carService);
        if(TestRowFormArray.length > 0)
            TestForm.setTestRowForm(TestRowFormArray);
        if(TestRowFormArray!=null){ 
            TestForm.setTestRowForm(TestRowFormArray);
            TestForm.setTotalRows(TestRowFormArray.length);
        }
    }

JSF:

<rich:dataTable
        value="#{testController.testForm.testRowForm}"
        rows="#{testController.noOfRecordsToShow}" var="resultRow" noDataLabel="No Result Found"
        headerClass="ColumnHeader" styleClass="DataTable" rowKeyVar="itc"
        style="width:980px;" id="dtTable">
1

1 Answers

0
votes

You should clean up data source for data table in case when result set is empty too.