MAF.control.Grid

Basically the same as MAF.element.Grid, with the exception that this has default styling.

new MAF.control.Grid()

Methods

animate(config) inherited

Parameters:

NameTypeDescription
configObject

A config object

Fires:

attachAccessories(arguments) inherited

Attach multiple accessory components to this component.

Parameters:

NameTypeDescription
argumentsArray

Contains muliple accessory components.

Returns:

This component.

attachAccessory(accessory) inherited

Attach a accessory component to this component so it can update on grid events.

Parameters:

NameTypeDescription
accessoryClass

The accessory component.

Returns:

This component.

blurCell() inherited

Blur focus of the given parameter target, which can be a cell, an index, or coordinates of where to blur focus.

Returns:

This component.

changeDataset(data, reset, dataLength) → {MAF.element.Grid} inherited

Parameters:

NameTypeArgumentDefaultDescription
dataArray

Data objects that will change the content of the grid.

resetBooleanoptional false

This will reset the page the grid will display to 0 when true.

dataLengthNumberoptional 

When the dataset will be larger then the passed in array in length.

Fires:

Returns:

changePage(pagenum, options) inherited

Change page of the grid.

Parameters:

NameTypeDescription
pagenumNumber

Number of the page to change to.

optionsObject

Options to change the state of the grid.

focus() inherited

Give the grid focus.

focusCell(target) inherited

Change focus to the given parameter target.

Parameters:

NameTypeDescription
targetMixed

Can be a cell, an index, or coordinates of where to set focus

Returns:

This component.

freeze() → {Class} inherited

Freezes this component. Screen renders no longer trigger until thawed.

Returns:

This component.

getAbsolutePosition() → {Object} inherited

Give back the position relative to its first positioned ancestor element

Returns:

{hOffset:Number, vOffset: Number}

getCellCoordinates() → {Object} inherited

Returns:

With row, column, rows and columns

getCellCount() → {Number} inherited

Returns the cell count of a fully populated grid page. Returns this.config.rows * this.config.columns.

Returns:

The total number of cells on a grid page.

getCellDataIndex(c) → {Number} inherited

Parameters:

NameTypeDescription
cObject | Number

Can be a Cell, index or a row.

Returns:

Dataset Index.

getCellDataItem(c) → {Mixed} inherited

Parameters:

NameTypeDescription
cMixed

Can be a cell, index, or row.

Returns:

Returns a dataset item.

getCellDimensions() → {Object} inherited

Returns:

With the width and height of the cells for the grid.

getCellIndex(a, b) → {Number} inherited

Parameters:

NameTypeDescription
aObject | Number

Can be a Cell, index or a row.

bNumber

Row

Returns:

Index of the cell if found. Otherwise it returns -1.

getCurrentPage() inherited

Returns:

The zero-based index of the current page of data.

getDataItem(index) → {object} inherited

Get the data item with the specified index.

Parameters:

NameTypeDescription
indexindex

The index of the data item to find.

Returns:

The data item with the passed index.

getFocusCoordinates() → {Object} inherited

Returns:

Row and column properties of the last focused cell.

getFocusIndex() inherited

Returns:

Index of last focused cell.

getPageCount() inherited

Returns:

this.pager.getNumPages(). The number of pages in the dataset.

getStartIndex() inherited

Returns:

The dataset index of the first cell on the current page.

getState() → {Object} inherited

Returns:

State object of the grid.

getView() → {Class} inherited

Returns:

Returns the view this class is appended on.

getVisibleCellCount() inherited

Returns the cell count of currently visible cells.

hide() → {Class} inherited

Hides this component.

Returns:

This component.

initialize() inherited

Initialize the class

normalizeIndex() → {Number} inherited

Returns:

Starting index of the page containing the desired data item.

releaseFocus(direction, event) → {boolean} inherited

Deprecated This will probably be removed in the next major MAF release.

Parameters:

NameTypeArgumentDescription
directionstring

The direction to release the focus too.

eventeventoptional 

Returns:

Always will return true now.

setFilter(fn) inherited

Parameters:

NameTypeDescription
fnfunction

A function used as a test for each element in the data set.

Example

grid.setFilter(function (value) {
   if (value.type === 'demo')
      return value;
});

shift(type, options) inherited

Shifts the grid to the page based on the parameter type.

Parameters:

NameTypeDescription
typeString

You can use:

  • first - Shift grid to the first page.
  • last - Shift grid to the last page.
  • up - Shift grid to the previous page.
  • down - Shift grid to the next page.
  • left - Shift grid to the previous page.
  • right - Shift grid to the next page.
optionsObject

Options to change the state of the grid.

show() → {Class} inherited

Shows this component.

Returns:

This component.

thaw() → {Class} inherited

Thawes this component. Screen renders can trigger again.

Returns:

This component.

updateState(state) → {Object} inherited

Parameters:

NameTypeDescription
stateObject

Object to update the states of the grid with.

Returns:

The updated state.

Events

onAnimationEnded

Fired when a animation on this component has ended.

onAppend

Fired when component has appended to a parent. Update visual appearances by applying a Theme style and rendering the skin.

onBlur

Fired when the component is blurred.

onChangeDisabled

Fired when this component changes it enabled or disabled state.

onChangePage

Fired before a page on the grid will be changed.

onDatasetChanged

Fired when the data set of the grid has changed.

onDisable

Fired when this component changes it state to disabled.

onEnable

Fired when this component changes it state to enabled.

onFocus

Fired when the component recieves focus.

onNavigate

Fired when a navigation happens when the component has focus.

onPageChanged

Fired after a page on the grid has changed.

onSelect

Fired when the component is selected.

onStateUpdated

Fired when state of the grid is updated/changed.