Wtx ~ Wt Extension Library
WtxLib
Classes | Functions
Wtx::Sys::Lookup Namespace Reference

Lookups (things for combo-boxes) More...

Classes

class  Definition
 
class  Item
 
class  ItemDelegate
 
class  ManagerWidget
 
class  Template
 

Functions

void mapClasses (Wtx::Dbo::Session &session)
 
void postCreateTables (Wtx::Dbo::Session &session)
 
Wtx::Sys::Lookup::Item::Ptr load (int id, Wtx::Dbo::Session &session)
 
Wtx::Sys::Lookup::Item::Ptr load (const std::string &id, Wtx::Dbo::Session &session)
 
Wtx::Sys::Lookup::Item::Ptr load (const Wt::WString &id, Wtx::Dbo::Session &session)
 
Wtx::Sys::Lookup::Item::Ptr add (const std::string &key, const std::string &group, Wtx::Dbo::Session &session)
 Add an item to the lookup table. More...
 
Wtx::Sys::Lookup::Item::Ptr find (int id, Wtx::Dbo::Session &session)
 
Wtx::Sys::Lookup::Item::Ptr find (const std::string &key, Wtx::Dbo::Session &session)
 
Wtx::Sys::Lookup::Item::Ptr ifind (const std::string &key, Wtx::Dbo::Session &session)
 
Wtx::Sys::Lookup::Item::Ptr xfind (const std::string &xid, Wtx::Dbo::Session &session)
 
Wtx::Sys::Lookup::Item::Vector vectorGroup (const std::string &group, Wtx::Dbo::Session &session)
 
std::shared_ptr< Wt::WAbstractItemModel > getComboBoxModel (int tid, const std::string &group, Wtx::Dbo::Session &session, bool includeBlank=false)
 Get a Combo-Box Model. More...
 
Wt::WItemDelegate * delegate (Wtx::Dbo::Session *s)
 

Detailed Description

Lookups (things for combo-boxes)

This utility is used to populate combo-boxes in the user interface. Each entry in to a combo-box is referenced by specifying a group value. The group value can be any key word. Multiple group values are separated by a ',' (comma). A '*' (asterisk) resolves all group values. There is at least 1 item (usually the first item) that has no keyField value. This item is used to offer the combo-box a (null-like) value, allowing users to clear the combo-box.

warehouse_demo=> select * from "sysLookup" order by id;
id | keyField | cfyField | description | system
----+-----------+-----------------------------------+-------------+--------
1 | | * | | f
2 | Active | mrpInventoryStatus,mrpOrderStatus | | f
3 | Inactive | mrpInventoryStatus | | f
4 | Hold | mrpInventoryStatus | | f
5 | Destroyed | mrpInventoryStatus | | f
6 | New | mrpOrderStatus | | f
7 | InWork | mrpOrderStatus | | f
(7 rows)

Function Documentation

Wtx::Sys::Lookup::Item::Ptr Wtx::Sys::Lookup::add ( const std::string &  key,
const std::string &  group,
Wtx::Dbo::Session session 
)

Add an item to the lookup table.

This will add an item to the look-up table, and return that newly added item.

This procedure first checks the look-up table to see if an item exists.

If an item cannot be found it is simply added.

The item is then checked to see if the 'group' field (aka; cfyField) contains the group-value of this look-up item, and if it is not present, it is added to the group string, preserving any existing group-values contained in that field.

Definition at line 30 of file Lookup.cpp.

std::shared_ptr< Wt::WAbstractItemModel > Wtx::Sys::Lookup::getComboBoxModel ( int  tid,
const std::string &  group,
Wtx::Dbo::Session session,
bool  includeBlank = false 
)

Get a Combo-Box Model.

This will create a item model from the Lookup table based on the 'group' value. It is possible to specify the .tid. or 'target-ID' for the item. When the .tid. is provided (isn't -1) then the model will be filled with only that one item. This is useful when the combo-box needs to be populated with the current target value, but doesn't need to (yet) carry all the possible combo-box selection items - as this can result in literally 100's of items populating the combo box result values. It is unnecessary to populate all the combo boxes on an input forms with all the possible selection choices, as this just leads to a slow-loading user interface.

Definition at line 213 of file Lookup.cpp.