Ember components to build drag-and-drop multi-column grids powered by gridstack.js
ember install ember-gridstack
Ember <= 2.4
ember install ember-assign-polyfill
Used to construct a grid-stack layout
{{grid-stack}}
can take an options
object attribute to configure the grid. All gridstack grid options are valid and take the form data-gs-{option}
. However, when using {{grid-stack}}
the data-gs
is omitted.
Example:
The full list of options can be found here: https://github.com/troolee/gridstack.js/tree/master/doc#grid-attributes
All gridstack events can be handled as Ember actions. They take the form on{Eventname}
.
Example:
The full list of events can found here: https://github.com/troolee/gridstack.js/tree/master/doc#events
The {{grid-stack}}
component uses the block form to yield {{grid-stack-item}}
components. In addition, {{grid-stack}}
yields a reference to itself in the case inner components need the reference or would like to listen to events triggered on the grid element.
Example:
Used to construct a grid item inside a {{grid-stack}}
component
{{grid-stack-item}}
can take an options
object attribute to configure the grid item. All gridstack item options are valid and take the form data-gs-{option}
. However, when using {{grid-stack-item}}
the data-gs
is omitted.
Example:
The full list of options can be found here: https://github.com/troolee/gridstack.js/tree/master/doc#item-attributes
The {{grid-stack-item}}
component uses the block form to yield the content of the item. In addition, {{grid-stack-item}}
yields a reference to itself in the case inner components need the reference or would like to listen to events triggered on the grid.
Example:
//custom-component.js
export default Ember.Component.extend({
didInsertElement() {
this._super(...arguments);
this.get('parentContainer').$().on('resizestop', () => {
//handle resize
});
}
});
By default, the bower dependencies for Gridstack will be installed automatically.
You can exclude the optional jquery.ui.touch-punch dependency by using
the following configuration in your config/environment.js
:
// config.environment.js
module.exports = function(environment) {
return {
'ember-gridstack': {
// Exclude the optional jquery.ui.touch-punch dependency
exclude: ['jquery.ui.touch-punch']
}
};