How does ExtendedTableDataModel reset method work? Is there documentation?
Asked Answered
D

1

10

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.

Ducat answered 3/12, 2013 at 23:0 Comment(0)
N
0

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.

Narcho answered 4/12, 2013 at 12:20 Comment(2)
Unfortunately the code doesn't help elucidate. And your explanation really doesn't help. It doesn't add to the ExtendedTableDataModel javadoc in any way.Ducat
The DataModel keeps a reference to a source of data and keeps some data locally, the reset method clears the local cache. I would assume the method is used when your local data are not up-to-date. That said I have found no examples of the method being used.Narcho

© 2022 - 2024 — McMap. All rights reserved.