Xplain.Db.State

Xplain.Db.State(conf)

This class represents a Xplain State.

getAttribute

getAttribute()

Returns the attribute to which this state belongs. If this state’s parent is a state (and not an attribute), this method will call this state’s parent state getAttribute method.

Returns

the attribute to which this state belongs {Xplain.Db.Attribute}

getId

getId()

Returns the ID of this state. The ID of this state is the concatenation of the ID of this state’s parent object and this state’s ID.

Returns

id {string}

getName

getName()

Returns the name of this state.

Returns

name {string}

getParent

getParent()

returns this state’s parent dimension

Returns

object {Xplain.Db.Dimension} this state’s parent dimension

getSession

getSession()

Returns the session to which this state belongs.

Returns

session {Xplain.Db.Session}

getStates

getStates([settings, ]noAjax)

A state may have children states. This function returns the direct descendants of this state. If not yet fetched, this triggers an ajax request to fetch all states. If already fetched once, this simply returns an array of Xplain.Db.State entries. If an ajax request is being triggered, and this ajax request is being performed synchronously, this method also returns an array of Xplain.Db.State entries. If the ajax request is being performed asynchronously, the success function will receive an array of Xplain.Db.State entries as input parameter.

Parameters
  • (optional) (function settings.error=f(data){throw new Xplain.Db.Exception}) – A set of key/value pairs that configure the getStates request. All settings are optional. A default can be set using the Xplain.Db.Configuration.setDefaults() method.

  • (optional) – Defines if the request sent to the backend should be asynchronous or synchronous.

  • (optional) – Defines if the request should support CORS (note: the backend also has to enable CORS requests).

  • (optional) – The URL used for this request.

  • (optional) – number of milliseconds until a timeout will be triggered.

  • (optional) – function what will be triggered if the Xplain Data backend reports an HTTP Status Code 200. The first parameter passed to this function will be an array of Xplain.Db.State instances

  • (optional) – function what will be triggered if the Xplain Data backend reports anything but a HTTP Status Code 200. The first parameter passed to this function will be an instance of the data returned by the backend.

  • noAjax (boolean) – If true, the current states will be returned. If no states are set yet, an empty array will be returned (and no ajax call will be triggered)

Returns

array of {Xplain.Db.State}

isLeaf

isLeaf()

Returns true if the leaf is set and the this state is a leaf state. ATTENTION: currently, in most cases this flag will NOT BE SET and therefore this method will return undefined.

Returns

the value of the leaf flag {boolean}

isRootState

isRootState()

Returns true if this state’s parent is an attribute and not a state, i.e. if this is the root state.

Returns

true if this state’s parent is an attribute {boolean}