How does ExtendedTableDataModel reset method work? Is there documentation?

273 views Asked by At

How does ExtendedTableDataModel (in RichFaces library) work after sorting or having the actual data changed? I'm asking for good quality documentation first and foremost, but also your own intelligent insights beyond that.

Specifically, how does the reset method work and why should we ensure it's called it every time the data model is obtained by JSF/RichFaces rendering engine (as seen in various unexplained code samples working with this data model)?

Sorry for asking for help with Google, but that in itself makes me feel like it deserves a question here on SO. The best I can find is the RichFaces javadocs which say:

public void reset()

Resets internal cached data. Call this method to reload data from data provider on first access for data.

1

There are 1 answers

2
Makhiel On

Can't you just look at the code in your IDE?

Of course, there are pages like grepcode.com that do that for you:

public void reset() {
    wrappedKeys = null;
    wrappedData.clear();
    rowCount = null;
    rowIndex = -1;
    rowKey = null;
}

It is used to clear the data so that when they are needed next time they will be reloaded from the source.