Interface Gridster

Index

Methods

Methods

public add_widget(html: string, size_x?: number, size_y?: number, col?: number, row?: number): JQuery

Create a new widget with the given html and add it to the grid.

Parameters

  • html: string

    The string representing the HTML of the widget or the HTMLElement.

  • size_x?: number optional

    The number of rows the widget occupies horizontally. Defaults to 1.

  • size_y?: number optional

    The number of columns the widget occupies vertically. Defaults to 1.

  • col?: number optional

    The column the widget should start in.

  • row?: number optional

    The row the widget should start in.

Returns

JQuery

Returns the jQuery wrapped HTMLElement representing the widget that was just created.

public add_widget(html: HTMLElement, size_x?: number, size_y?: number, col?: number, row?: number): JQuery

see

add_widget

Parameters

  • html: HTMLElement
  • size_x?: number optional
  • size_y?: number optional
  • col?: number optional
  • row?: number optional

Returns

JQuery

public disable(): Gridster

Disables dragging.

Returns

Gridster

Returns the instance of the Gridster class.

public enable(): Gridster

Enables dragging.

Returns

Gridster

Returns the instance of the Gridster class.

public remove_widget(el: HTMLElement, silent?: boolean, callback?: (el: HTMLElement) => void): Gridster

Remove a widget from the grid.

Parameters

  • el: HTMLElement

    The jQuery wrapped HTMLElement you want to remove.

  • silent?: boolean optional

    Boolean If true widgets below the removed one will not move up.

  • callback?: (el: HTMLElement) => void optional

    Callback function executed when the widget is removed.

Returns

Gridster

Returns the instance of the Gridster class.

public remove_widget(el: HTMLElement, callback: (el: HTMLElement) => void): Gridster

see

remove_widget

Parameters

  • el: HTMLElement
  • callback: (el: HTMLElement) => void

Returns

Gridster

public resize_widget($widget: JQuery, size_x?: number, size_y?: number, callback?: (size_x: number, size_y: number) => void): JQuery

Change the size of a widget.

Parameters

  • $widget: JQuery

    The jQuery wrapped HTMLElement that represents the widget is going to be resized.

  • size_x?: number optional

    The number of rows that the widget is going to span. Defaults to current size_x.

  • size_y?: number optional

    The number of columns that the widget is going to span. Defaults to current size_y.

  • callback?: (size_x: number, size_y: number) => void optional

    Callback function wehn the widget is finished resizing.

Returns

JQuery

Returns $widget.

public serialize($widgets?: Array<HTMLElement>): Array<T>

Returns a serialized array of the widgets in the grid.

Parameters

  • $widgets?: Array<HTMLElement> optional

    The collection of jQuery wrap ed HTMLElements you want to serialize. If no argument is passed a l widgets will be serialized.

Returns

Array<T>

Returns an array of objects with the data specified in the serialized_params option.

public serialize_changed(): Array<T>

Returns a serialized array of the widgets that have changed their position.

Returns

Array<T>

Returns an array of objects with the data specified in the serialized_params option.