From 446f59a6a902c265129dbcde50ac4e5abd677993 Mon Sep 17 00:00:00 2001 From: Pavel Reznikov Date: Mon, 17 Nov 2014 00:58:57 -0800 Subject: [PATCH] events/API description --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/README.md b/README.md index 185948c..5c9493e 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,39 @@ Usage - `data-gs-no-resize` - disable element resizing - `data-gs-auto-position` - tells to ignore `data-gs-x` and `data-gs-y` attributes and to place element to the first available position + +## Events + +### onchange + +Occurs when widgets change their position/size + +```javascript + $('.grid-stack').on('change', function (e, items) { + serialize_widget_map(items); + }); +``` + +## API + +### add_widget(el, x, y, width, height, auto_position) + +Creates new widget. + +Parameters: + +- `el` - widget to add +- `x`, `y`, `width`, `height` - widget position/dimensions (Optional) +- `auto_position` - if `true` then `x`, `y` parameters will be ignored and widget will be places on the first available +position + +### remove_widget(el) + +Removes widget from the grid. + +Parameters: + +- `el` - widget to add ## Use with knockout.js