Zebra API Doc

zebra.ui.grid.GridCaption Class

Grid caption class that implements rendered caption. Rendered means all caption titles, border are painted as a number of views.

Constructor

zebra.ui.grid.GridCaption

(
  • [titles]
  • [render]
)

Parameters:

  • [titles] Array optional

    a caption titles. Title can be a string or a zebra.ui.View class instance

  • [render] zebra.ui.StringRender | zebra.ui.TextRender optional

    a text render to be used to paint grid titles

Methods

calcRowColAt

(
  • x
  • y
  • [f]
)
Integer

Inherited from zebra.ui.grid.BaseCaption:

Compute a column (for horizontal caption component) or row (for vertically aligned caption component) at the given location

Parameters:

  • x Integer

    a x coordinate

  • y Integer

    an y coordinate

  • [f] Function optional

    an optional match function. The method can be passed if you need to detect a particular area of row or column. The method gets a grid metrics as the first argument, a x or y location to be detected,
    a row or column y or x coordinate, a row or column height or width and row or column index. The method has to return true if the given location is in.


Return: Integer

a row or column

getCaptionPS

(
  • rowcol
)
Integer

Inherited from zebra.ui.grid.BaseCaption:

Get the given row or column caption preferred size

Parameters:

  • rowcol Integer

    a row or column of a caption


Return: Integer

a size of row or column caption

getTitleView

(
  • i
)
zebra.ui.View

Get a grid caption column or row title view

Parameters:

  • i Integer

    a row (if the caption is vertical) or column (if the caption is horizontal) index


Return: zebra.ui.View

a view to be used as the given row or column title view

matrixResized

(
  • target
  • prevRows
  • prevCols
)

Inherited from zebra.ui.grid.BaseCaption:

Implement the method to be aware when number of rows or columns in a grid model has been updated

Parameters:

  • target zebra.ui.grid.Grid

    a target grid

  • prevRows Integer

    a previous number of rows

  • prevCols Integer

    a previous number of columns

matrixSorted

(
  • target
  • sortInfo
)

Inherited from zebra.ui.grid.BaseCaption:

Implement the method to be aware when a grid model data has been re-ordered.

Parameters:

mouseClicked

(
  • e
)

Inherited from zebra.ui.grid.BaseCaption:

Define mouse clicked events handler.

Parameters:

mouseDragEnded

(
  • e
)

Inherited from zebra.ui.grid.BaseCaption:

Define mouse drag ended events handler.

Parameters:

mouseDragged

(
  • e
)

Inherited from zebra.ui.grid.BaseCaption:

Define mouse dragged events handler.

Parameters:

mouseDragStarted

(
  • e
)

Inherited from zebra.ui.grid.BaseCaption:

Define mouse drag started events handler.

Parameters:

mouseMoved

(
  • e
)

Inherited from zebra.ui.grid.BaseCaption:

Define mouse moved events handler.

Parameters:

putTitle

(
  • rowcol
  • title
)

Put the given title for the given caption cell.

Parameters:

  • rowcol Integer

    a grid caption cell index

  • title String | zebra.ui.View

    a title of the given grid caption cell. Can be a string or zebra.ui.View class instance

setTitleProps

(
  • rowcol
  • ax
  • ay
  • bg
)

Set the given grid caption cell title properties such as: vertical and horizontal alignment, background color.

Parameters:

  • rowcol Integer

    a grid caption cell index

  • ax Integer | String

    a horizontal alignment of the given cell title. Can be: zebra.layout.LEFT ("left"), zebra.layout.CENTER ("center"), zebra.layout.RIGHT ("right")

  • ay Integer | String

    a vertical alignment of the given cell title. Can be: zebra.layout.TOP ("top"), zebra.layout.CENTER ("center"), zebra.layout.BOTTOM ("bottom")

  • bg String

    a background color

Attributes

activeAreaSize

Number

Inherited from zebra.ui.grid.BaseCaption:

Size of the active area where cells size can be changed by mouse dragging event

Default: 5

isAutoFit

Boolean

Inherited from zebra.ui.grid.BaseCaption:

Indicate if the grid cell size has to be adjusted according to the cell preferred size by mouse double click event.

Default: true

isResizable

Boolean

Inherited from zebra.ui.grid.BaseCaption:

Indicate if the grid cells are resize-able. to the cell preferred size by mouse double click event.

Default: true

lineColor

String

Inherited from zebra.ui.grid.BaseCaption:

Caption line color

Default: "gray"

minSize

Number

Inherited from zebra.ui.grid.BaseCaption:

Minimal possible grid cell size

Default: 10

Events

captionResized

Inherited from zebra.ui.grid.BaseCaption:

Fire when a grid row selection state has been changed

   caption.bind(function captionResized(caption, rowcol, phw) {
       ... 
   });

Event Parameters:

  • caption zebra.ui.grid.BaseCaption

    a caption

  • rowcol Integer

    a row or column that has been resized

  • pwh Integer

    a a previous row or column size