简体   繁体   中英

How does ExtendedTableDataModel reset method work? Is there documentation?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM