Feature #4566 » 0001-WTableView-Support-for-model-data-caching.patch
src/Wt/WAbstractItemModel | ||
---|---|---|
| MatchWrap))
|
||
const;
|
||
/*! \brief Prepare the data beforehand.
|
||
*
|
||
* This is call before the retrieving the data. In some situtations it
|
||
* it would be better to load the bulk of the data, insted of one by one.
|
||
* This is mainly used by virtual table views.
|
||
*/
|
||
virtual void prepareData(int rowFrom, int rowTo);
|
||
/*! \brief Returns the data item at the given column and row.
|
||
*
|
||
* This is a convenience method, and is equivalent to:
|
src/Wt/WAbstractItemModel.C | ||
---|---|---|
return result;
|
||
}
|
||
void WAbstractItemModel::prepareData(int rowFrom, int rowTo)
|
||
{ }
|
||
boost::any WAbstractItemModel::data(int row, int column, int role,
|
||
const WModelIndex& parent) const
|
||
{
|
src/Wt/WTableView.C | ||
---|---|---|
for (int i = 0; i < -bottomRowsToAdd; ++i)
|
||
removeSection(Bottom);
|
||
//If there are some columns defined
|
||
if(rowHeaderCount() > 0 || (firstColumn() < lastColumn()))
|
||
{
|
||
// Only if got top rows
|
||
if(topRowsToAdd > 0)
|
||
model()->prepareData(firstRow() - topRowsToAdd, firstRow());
|
||
// Only if got bottom rows
|
||
else if(bottomRowsToAdd > 0)
|
||
model()->prepareData(lastRow() + 1, lastRow() + bottomRowsToAdd);
|
||
}
|
||
// Add rows
|
||
for (int i = 0; i < topRowsToAdd; i++) {
|
||
int row = firstRow() - 1;
|
||
... | ... | |
addSection(Bottom, items);
|
||
}
|
||
// Only if there are some columns to add and we've got some rows
|
||
if((leftColsToAdd > 0 || rightColsToAdd > 0) && firstRow() < lastRow())
|
||
model()->prepareData(firstRow(), lastRow());
|
||
// Add columns
|
||
for (int i = 0; i < leftColsToAdd; ++i) {
|
||
int col = firstColumn() - 1;
|