Wtx ~ Wt Extension Library
WtxLib
Classes | Public Member Functions | Public Attributes | List of all members
Wtx::TableViewDef Class Reference

Table View Definition. More...

#include <TableViewDef.h>

+ Inheritance diagram for Wtx::TableViewDef:

Classes

class  ColumnDef
 Table View Column Def. More...
 
class  ViewDef
 Table View Definition. More...
 

Public Member Functions

bool load (const std::string &name, const Wtx::Dbo::TableDef &tableDef, Wtx::Dbo::Session *session)
 
bool load (const Wtx::Dbo::TableDef &tableDef, Wtx::Dbo::Session *session)
 
bool load (const ViewDef &viewDef, Wtx::Dbo::Session *session)
 
bool save (const std::string &name, Wtx::Dbo::Session *session)
 
bool hasFlag (const std::string &value)
 
void editProperties ()
 
Wt::Signal & changed ()
 

Public Attributes

std::string m_name
 
ViewDef m_def
 

Detailed Description

Table View Definition.

The Table View Definition objet encapsulates all the settings required to build a table view. In order to build a complete table view, some of the settings must be applied to the data model, and some of the settings must be applied to the table view itself. This class brings all those settings in to one location, so they can be easily manipulated by the application.

The Table View Definition can be initialized through a number of methods; manually, where each setting is applied one at a time, through a Definition_t structure, where each value is specified in a statically initialized structure, or through a Json string, where each value appears similar to the static structure, but in Json format, making for easy back-end storage.

252 Wtx::TableViewDef::Definition_t viewDef =
253 {
254 "Blog Entries", // title
255 "", // tip
256 0, // headerCount
257 Wt::SelectionMode::Single, // selectionMode
258 true, // columnResizeEnabled
259 true, // alternatingRowColors
260 "", // sql
261 "", // filter
261a "", // idin (ID appears in this sql)
262 0, // doubleClick
263 true, // showHeader
264 true, // showFooter
264 false, // hideSearch
265 false, // allowFilter
266 false, // allowAdd
267 false, // allowChange
268 false, // allowDelete
269 true, // allowExport
270 true, // allowSearch
271 nullptr, // itemDelegate
272
273
274 // sortFields
275 {
276 "id DESC"
277 },
278
279 // search fields
280 {
281 },
282
283 // column defs
284 {// field label width toolTip delegate
285 { "id", "", 50, "", nullptr },
286 { "isActive", "", 75, "", nullptr },
287 { "datePosted", "", 125, "", nullptr },
288 { "keyField", "", 350, "", nullptr }
289 }
290
291 };

To create the view, it is a simple matter of creating a new view object, and applying the view layout definition to the constructor:

auto tv = std::make_unique< Wtx::Dbo::TableView<Wtx::Web::BlogEntry::Item> >( viewDef, session() );

Definition at line 134 of file TableViewDef.h.

Member Function Documentation

void Wtx::TableViewDef::editProperties ( )
Todo:
fix this

Definition at line 326 of file TableViewDef.cpp.


The documentation for this class was generated from the following files: