grid.min_width is not a function
var grid = $('.grid-stack').data('gridstack');
var widget = grid.add_widget($('<div>' + temp + '</div>'), 2, 1, 3, 3);
grid.min_width(widget, 3);
grid.min_width is not a function is giving me in console output Why is that?
The prototype methods haven't been added to gridstack yet. Refer this to this note on the readme
I just ran into this a few days ago; If you take the prototypes from the master branch and past them into your local gridstack.js it should work here's the code.
GridStack.prototype.min_height = function (el, val) {
el = $(el);
el.each(function (index, el) {
el = $(el);
var node = el.data('_gridstack_node');
if (typeof node == 'undefined' || node == null) {
return;
}
if(!isNaN(val)){
node.min_height = (val || false);
el.attr('data-gs-min-height', val);
}
});
return this;
};
GridStack.prototype.min_width = function (el, val) {
el = $(el);
el.each(function (index, el) {
el = $(el);
var node = el.data('_gridstack_node');
if (typeof node == 'undefined' || node == null) {
return;
}
if(!isNaN(val)){
node.min_width = (val || false);
el.attr('data-gs-min-width', val);
}
});
return this;
};
This isn't fully released yet in an actual version. So the next time you do an update from either npm/ nuget/bower know full well that those changes you've made to your local gridstack will be overwritten. And you'll lose the functionality.
I have code in my current project sitting ready to go with these once v0.2.4 is released.