You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by techie_techie <sa...@wipro.com> on 2008/06/19 08:31:30 UTC

Datatable usage best practice question.

I am using a tomahawk datatable and data to be displayed comes from CSV file.
We parse CSV file and prepare a list of Object.

we want to reload the session data so that every view to get the most recent
data and to avoid duplicate reloads I have put a check like this:
 
    public List<MyData> getDataList() {
        if (this.dataList== null ||
FacesContext.getCurrentInstance().getRenderResponse()) {
            loadDataList(); // Reload to get most recent data.
        }
        return this.dataList;
    }
Managed bean scope is session.

It works fine so far. But now issue is when we click sortColumn link again
it gets the data from the CSV file even though CSV file is not changed. To
avoid these issues we are thinking of this solution:

    // So basically we prepare datalist only if somebody has changed CSV
file.
    public List<MyData> getDataList() {
        if (this.dataList== null || isCsvFileUpdated()) {
            loadDataList(); // Reload to get most recent data.
        }
        return this.dataList;
    }

Is this approach fine? Do you see any issue with this appraoch?

TIA...
-- 
View this message in context: http://www.nabble.com/Datatable-usage-best-practice-question.-tp17998175p17998175.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.