[](http://waffle.io/troolee/gridstack.js)
gridstack.js is a jQuery plugin for widget layout. This is drag-and-drop multi-column grid. It allows you to build
draggable responsive bootstrap v3 friendly layouts. It also works great with [knockout.js](http://knockoutjs.com), [angular.js](https://angularjs.org) and touch devices.
Inspired by [gridster.js](https://github.com/ducksboard/gridster.js). Built with love.
gridstack.js is a mobile-friendly Javascript library for dashboard layout and creation. Making a drag-and-drop, multi-column dashboard has never been easier. gridstack.js allows you to build draggable, responsive bootstrap v3-friendly layouts. It also works great with [knockout.js](http://knockoutjs.com), [angular.js](https://angularjs.org), [ember](https://www.emberjs.com/).
Join gridstack.js on Slack: https://gridstackjs.troolee.com
...
...
@@ -20,51 +16,40 @@ Join gridstack.js on Slack: https://gridstackjs.troolee.com
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents***generated with [DocToc](http://doctoc.herokuapp.com/)*
-[Demo](#demo)
-[gridstack.js News](#gridstackjs-news)
-[Demo and examples](#demo-and-examples)
-[Usage](#usage)
-[Requirements](#requirements)
-[Using gridstack.js with jQuery UI](#using-gridstackjs-with-jquery-ui)
-[Install](#install)
-[Basic usage](#basic-usage)
-[Migrating to v0.3.0](#migrating-to-v030)
-[Migrating to v0.2.5](#migrating-to-v025)
-[API Documentation](#api-documentation)
-[Questions and Answers](#questions-and-answers)
-[Touch devices support](#touch-devices-support)
-[Use with knockout.js](#use-with-knockoutjs)
-[Use with angular.js](#use-with-angularjs)
-[Rails integration](#rails-integration)
-[gridstack.js for specific frameworks](#gridstackjs-for-specific-frameworks)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
Demo
gridstack.js News
=====
Version 1.0 is coming! Check out the blog post here for more information:
[https://dylandreams.com/2017/04/26/gridstack-10-coming-soon/](https://dylandreams.com/2017/04/26/gridstack-10-coming-soon/) and [subscribe to the blog](https://dylandreams.com) for more gridstack news and tutorials.
Demo and examples
====
Please visit http://troolee.github.io/gridstack.js/ for demo. Or check out [these example](http://troolee.github.io/gridstack.js/demo/).
Please visit http://troolee.github.io/gridstack.js/ for a demo or check out [these examples](http://troolee.github.io/gridstack.js/demo/).
Usage
...
...
@@ -84,6 +69,8 @@ Note: You can still use [underscore.js](http://underscorejs.org) (>= 1.7.0) inst
## Install
* In the browser:
```html
<linkrel="stylesheet"href="gridstack.css"/>
<script src="gridstack.js"></script>
...
...
@@ -93,8 +80,9 @@ Note: You can still use [underscore.js](http://underscorejs.org) (>= 1.7.0) inst
@@ -131,15 +119,12 @@ You can download files from `dist` directory as well.
<script type="text/javascript">
$(function(){
varoptions={
cellHeight:80,
verticalMargin:10
};
$('.grid-stack').gridstack(options);
$('.grid-stack').gridstack();
});
</script>
```
## Migrating to v0.3.0
As of v0.3.0, gridstack introduces a new plugin system. The drag'n'drop functionality has been modified to take advantage of this system. Because of this, and to avoid dependency on core code from jQuery UI, the plugin was functionality was moved to a separate file.
...
...
@@ -159,22 +144,11 @@ or
We're working on implementing support for other drag'n'drop libraries through the new plugin system.
## Migrating to v0.2.5
As of v0.2.5 all methods and parameters are in camel case to respect [JavaScript Style Guide and Coding Conventions](http://www.w3schools.com/js/js_conventions.asp).
All old methods and parameters are marked as deprecated and still available but a warning will be displayed in js console. They will be available until v1.0
when they will be completely removed.
## API Documentation
Please check out `doc/README.md` for more information about gridstack.js API.
Documentation can be found [here](https://github.com/troolee/gridstack.js/tree/develop/doc).
## Questions and Answers
Please feel free to as a questions here in issues, using [Stackoverflow](http://stackoverflow.com/search?q=gridstack) or [Slack chat](https://gridstackjs.troolee.com).
We will glad to answer and help you as soon as we can.
Also please check our FAQ `doc/FAQ.md` before asking in case the answer is already there.
## Touch devices support
...
...
@@ -203,93 +177,12 @@ $(function () {
If you're still experiencing issues on touch devices please check [#444](https://github.com/troolee/gridstack.js/issues/444)
For rails users, integration of gridstack.js and its dependencies can be done through [gridstack-js-rails](https://github.com/randoum/gridstack-js-rails)
See example: [Serialization demo](http://troolee.github.io/gridstack.js/demo/serialization.html)
If you're using knockout there is no need for such method at all.
## Override resizable/draggable options
You can override default `resizable`/`draggable` options. For instance to enable other then bottom right resizing handle
you can init gridsack like:
you can init gridstack like:
```javascript
$('.grid-stack').gridstack({
...
...
@@ -478,159 +317,13 @@ If you're using require.js and a single file jQueryUI please check out this
[Stackoverflow question](http://stackoverflow.com/questions/35582945/redundant-dependencies-with-requirejs) to get it
working properly.
Changes
=====
## Nested grids
Gridstack may be nested. All nested grids have an additional class `grid-stack-nested` which is assigned automatically
during initialization.
See example: [Nested grid demo](http://troolee.github.io/gridstack.js/demo/nested.html)
## Resizing active grid
Resizing on-the-fly is possible, though experimental. This may be used to make gridstack responsive. gridstack will change the total number of columns and will attempt to update the width and x values of each widget to be more logical.
See example: [Responsive grid demo](http://troolee.github.io/gridstack.js/demo/responsive.html)
- add `added` and `removed` events for when a widget is added or removed, respectively. ([#54](https://github.com/troolee/gridstack.js/issues/54))
- add `acceptWidgets` parameter. Widgets can now be draggable between grids or from outside *(experimental)*
#### v0.2.4 (2016-02-15)
- fix closure compiler/linter warnings
- add `static_grid` option.
- add `min_width`/`min_height` methods (Thanks to @cvillemure)
- add `destroy` method (Thanks to @zspitzer)
- add `placeholder_text` option (Thanks to @slauyama)
- add `handle_class` option.
- add `make_widget` method.
- lodash v 4.x support (Thanks to @andrewr88)
#### v0.2.3 (2015-06-23)
- gridstack-extra.css
- add support of lodash.js
- add `is_area_empty` method
- nested grids
- add `batch_update`/`commit` methods
- add `update` method
- allow to override `resizable`/`draggable` options
- add `disable`/`enable` methods
- add `get_cell_from_pixel` (thanks to @juchi)
- AMD support
- fix nodes sorting
- improved touch devices support
- add `always_show_resize_handle` option
- minor fixes and improvements
#### v0.2.2 (2014-12-23)
- fix grid initialization
- add `cell_height`/`cell_width` API methods
- fix boolean attributes (issue #31)
#### v0.2.1 (2014-12-09)
- add widgets locking (issue #19)
- add `will_it_fit` API method
- fix auto-positioning (issue #20)
- add animation (thanks to @ishields)
- fix `y` coordinate calculation when dragging (issue #18)
- fix `remove_widget` (issue #16)
- minor fixes
#### v0.2.0 (2014-11-30)
- add `height` option
- auto-generate css rules (widgets `height` and `top`)
- add `GridStackUI.Utils.sort` utility function
- add `remove_all` API method
- add `resize` and `move` API methods
- add `resizable` and `movable` API methods
- add `data-gs-no-move` attribute
- add `float` option
- fix default css rule for inner content
- minor fixes
#### v0.1.0 (2014-11-18)
Very first version.
License
=======
The MIT License (MIT)
Copyright (c) 2014-2016 Pavel Reznikov, Dylan Weiss
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
gridstack.js is currently maintained by [Pavel Reznikov](https://github.com/troolee) and [Dylan Weiss](https://github.com/radiolips). We appreciate [all contributors](https://github.com/troolee/gridstack.js/graphs/contributors) for help.