company logo

ControlContext :: changeDefaultOrder - Change order

The default order is the order defined by the data source. The function changes the default order for the data source of the control to key name passed in sKeyName. Typically, the function is called for trees, lists or tables. In case of tree, it changes also default orders for all subordinated regions. When calling the function for a drop list, the order for the list control is changed. When a data source does not support the required order, the default order for the data source remains unchanged.

Changing the default order for trees or tables does not have any visible effect when order by sort column has been activated (changeOrderColumn()). In order to activate the default order, column order has to be reset before (or after) changing the default order (changeOrderColumn(-1,false)).

In order to set or restore the default order for data sources (unordered or ordered by database index), an empty string may be passed in sKeyName.

OSI-fragment ... ChangeOrder( string keyName ) {

VARIABLES

  string       oldKey = defaultOrder();

  bool         desc   = false;

PROCESS

  if ( keyName != oldKey )

    changeDefaultOrder(keyName);

  else

    desc = !descending();    // toggle direction

  changeOrderColumn(-1,desc);// reset column order

}

Notes:

Since the function ignores unsupported key names, it may be called several times with different key names in order to change order for regions with different keys.

Implementation details

  1. Change order
    ControlContext  :: changeDefaultOrder ( odaba::String &sKeyName )

    The function changes the order of the tree, list or table to the database order passed in sKeyName.

    • sKeyName - Key name

      The key name is the name of a valid collection index (order) or key defined for the data type in the database model.

  2. to list
  3. Change generic key order
    ControlContext  :: changeDefaultOrder ( odaba::String &sKeyName, odaba::String &sGenericType )

    The function changes the order of the tree, list or table to the database order passed in sKeyName. The key passed must be a generic key that supports different generix types. The generic indes to be selected has to be passed in sGenericType.

    When the key name passed is empty (restore default order), the value passed as generic type will be ignored.

    • sKeyName - Key name

      The key name is the name of a valid collection index (order) or key defined for the data type in the database model.

    • sGenericType - Generic type

      The generic type is the name of an enumeration value (e.g. language) for locating generic instances.

  4. to list