#include <Wt/Ext/DataStore>
Public Member Functions | |
DataStore (WAbstractItemModel *model, DataLocation dataLocation, WObject *parent=0) | |
Create a new data store. | |
void | addColumn (int columnIndex, const std::string &jsonName) |
Add a column to the list of columns to be serialized. | |
void | setFilterColumn (int columnIndex) |
Set the column which is used to handle filter requests. | |
Protected Member Functions | |
virtual const std::string | resourceMimeType () const |
Return the mimetype. |
An instance of this class is used by ComboBox and TableView widgets to serialize data from a WAbstractItemModel. The data store can serialize data both for a ClientSide or ServerSide location of the data. When the location is ServerSide, the model supports transmission of certain data pages, and filtering of the model.
To use the data store, you need to specify which columns from the model need to be serialized.
Wt::Ext::DataStore::DataStore | ( | WAbstractItemModel * | model, | |
DataLocation | dataLocation, | |||
WObject * | parent = 0 | |||
) |
Create a new data store.
Data will be fecthed from model.
void Wt::Ext::DataStore::addColumn | ( | int | columnIndex, | |
const std::string & | jsonName | |||
) |
Add a column to the list of columns to be serialized.
The column columnIndex of the model is added to the current list of columns that are serialized. The jsonName provides the column label that is transmitted.
void Wt::Ext::DataStore::setFilterColumn | ( | int | columnIndex | ) |
Set the column which is used to handle filter requests.
A request for filtering data will be done by matching the given filter against data in the model at column columnIndex.
const std::string Wt::Ext::DataStore::resourceMimeType | ( | ) | const [protected, virtual] |
Return the mimetype.
Implement this method to return the correct mime type for your resource, e.g. "text/html".
Implements Wt::WResource.