Wt  3.7.1
Public Member Functions | Protected Member Functions | List of all members
Wt::Ext::DataStore Class Reference

A resource that serializes data from a data model. More...

#include <Wt/Ext/DataStore>

Inheritance diagram for Wt::Ext::DataStore:
Inheritance graph
[legend]

Public Member Functions

 DataStore (WAbstractItemModel *model, DataLocation dataLocation, WObject *parent=0)
 Create a new data store. More...
 
 ~DataStore ()
 Destructor.
 
void addColumn (int columnIndex, const std::string &jsonName)
 Add a column to the list of columns to be serialized. More...
 
void setFilterColumn (int columnIndex)
 Set the column which is used to handle filter requests. More...
 
- Public Member Functions inherited from Wt::WResource
 WResource (WObject *parent=0)
 Creates a new resource.
 
 ~WResource ()
 Destroys the resource. More...
 
void suggestFileName (const Wt::WString &name, DispositionType dispositionType=Attachment)
 Suggests a filename to the user for the data streamed by this resource. More...
 
const Wt::WStringsuggestedFileName () const
 Returns the suggested file name. More...
 
void setDispositionType (DispositionType cd)
 Configures the Content-Disposition header. More...
 
DispositionType dispositionType () const
 Returns the currently configured content disposition. More...
 
void setChanged ()
 Generates a new URL for this resource and emits the changed signal. More...
 
void setInternalPath (const std::string &path)
 Sets an internal path for this resource. More...
 
std::string internalPath () const
 Returns the internal path. More...
 
const std::string & generateUrl ()
 Generates an URL for this resource. More...
 
const std::string & url () const
 Returns the current URL for this resource. More...
 
SignaldataChanged ()
 Signal emitted when the data presented in this resource has changed. More...
 
void setUploadProgress (bool enabled)
 Indicate interest in upload progress. More...
 
Signal< ::uint64_t, ::uint64_t > & dataReceived ()
 Signal emitted when data has been received for this resource. More...
 
void write (std::ostream &out, const Http::ParameterMap &parameters=Http::ParameterMap(), const Http::UploadedFileMap &files=Http::UploadedFileMap())
 Stream the resource to a stream. More...
 
virtual void handleAbort (const Http::Request &request)
 Handles a continued request being aborted. More...
 
void haveMoreData ()
 Indicate that more data is available. More...
 
void setTakesUpdateLock (bool enabled)
 Set whether this resource takes the WApplication's update lock. More...
 
bool takesUpdateLock () const
 Returns whether this resources takes the WApplication's update lock. More...
 
- Public Member Functions inherited from Wt::WObject
 WObject (WObject *parent=0)
 Create a WObject with a given parent object. More...
 
virtual ~WObject ()
 Destructor. More...
 
virtual const std::string id () const
 Returns the (unique) identifier for this object. More...
 
virtual void setObjectName (const std::string &name)
 Sets an object name. More...
 
virtual std::string objectName () const
 Returns the object name. More...
 
void resetLearnedSlots ()
 Resets learned stateless slot implementations. More...
 
template<class T >
void resetLearnedSlot (void(T::*method)())
 Resets a learned stateless slot implementation. More...
 
template<class T >
WStatelessSlot * implementStateless (void(T::*method)())
 Declares a slot to be stateless and learn client-side behaviour on first invocation. More...
 
template<class T >
WStatelessSlot * implementStateless (void(T::*method)(), void(T::*undoMethod)())
 Declares a slot to be stateless and learn client-side behaviour in advance. More...
 
void isNotStateless ()
 Marks the current function as not stateless. More...
 
template<class T >
WStatelessSlot * implementJavaScript (void(T::*method)(), const std::string &jsCode)
 Provides a JavaScript implementation for a method. More...
 
void addChild (WObject *child)
 Adds a child object. More...
 
virtual void removeChild (WObject *child)
 Removes a child object. More...
 
const std::vector< WObject * > & children () const
 Returns the children.
 
WObjectparent () const
 Returns the parent object.
 

Protected Member Functions

virtual void handleRequest (const Http::Request &request, Http::Response &response)
 Handles a request. More...
 
- Protected Member Functions inherited from Wt::WResource
void beingDeleted ()
 Prepares the resource for deletion. More...
 
- Protected Member Functions inherited from Wt::WObject
virtual WStatelessSlot * getStateless (Method method)
 On-demand stateless slot implementation. More...
 

Additional Inherited Members

- Public Types inherited from Wt::WResource
enum  DispositionType { NoDisposition, Attachment, Inline }
 Values for the disposition type in the Content-Disposition header. More...
 
- Public Types inherited from Wt::WObject
typedef void(WObject::* Method) ()
 Typedef for a WObject method without arguments.
 
- Static Protected Member Functions inherited from Wt::WObject
static WObjectsender ()
 Returns the sender of the current slot call. More...
 

Detailed Description

A resource that serializes data from a data model.

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.

Constructor & Destructor Documentation

◆ DataStore()

Wt::Ext::DataStore::DataStore ( WAbstractItemModel model,
DataLocation  dataLocation,
WObject parent = 0 
)

Create a new data store.

Data will be fecthed from model.

Member Function Documentation

◆ addColumn()

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.

◆ handleRequest()

void Wt::Ext::DataStore::handleRequest ( const Http::Request request,
Http::Response response 
)
protectedvirtual

Handles a request.

Reimplement this method so that a proper response is generated for the given request. From the request object you can access request parameters and whether the request is a continuation request. In the response object, you should set the mime type and stream the output data.

A request may also concern a continuation, indicated in Http::Request::continuation(), in which case the next part for a previously created continuation should be served.

While handling a request, which may happen at any time together with event handling, the library makes sure that the resource is not being concurrently deleted, but multiple requests may happend simultaneously for a single resource.

Implements Wt::WResource.

◆ setFilterColumn()

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.


Generated on Tue Dec 15 2020 for the C++ Web Toolkit (Wt) by doxygen 1.8.13