-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Added minRow and row #1173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added minRow and row #1173
Changes from all commits
baa8cde
d52cc93
03c986d
b54d6c9
597d484
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -693,6 +693,12 @@ | |
|
||
opts = opts || {}; | ||
|
||
// if row property exists, replace minRow and maxRow | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move that down - feel weird to be first thing we check... like right after 715 where we set opts values. |
||
if (opts.row) { | ||
opts.minRow = opts.row; | ||
opts.maxRow = opts.row; | ||
} | ||
|
||
this.$el = $(el); // TODO: legacy code | ||
this.el = this.$el.get(0); // exposed HTML element to the user | ||
|
||
|
@@ -709,8 +715,10 @@ | |
var isNested = this.$el.closest('.' + opts.itemClass).length > 0; | ||
|
||
this.opts = Utils.defaults(opts, { | ||
row: parseInt(this.$el.attr('data-gs-row')) || 0, | ||
column: parseInt(this.$el.attr('data-gs-column')) || 12, | ||
maxRow: parseInt(this.$el.attr('data-gs-max-row')) || 0, | ||
minRow: parseInt(this.$el.attr('data-gs-row')) ? parseInt(this.$el.attr('data-gs-row')) : parseInt(this.$el.attr('data-gs-min-row')) || 0, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please extract this.$el.attr('data-gs-row') into a var right above - easier to read/parse. maybe |
||
maxRow: parseInt(this.$el.attr('data-gs-row')) ? parseInt(this.$el.attr('data-gs-row')) : parseInt(this.$el.attr('data-gs-max-row')) || 0, | ||
itemClass: 'grid-stack-item', | ||
placeholderClass: 'grid-stack-placeholder', | ||
placeholderText: '', | ||
|
@@ -1156,6 +1164,9 @@ | |
GridStack.prototype._updateContainerHeight = function() { | ||
if (this.engine._batchMode) { return; } | ||
var row = this.engine.getRow(); | ||
if (row < this.opts.minRow) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep, that is the right place to put it. as you can see you can also accomplish this with CSS |
||
row = this.opts.minRow; | ||
} | ||
// check for css min height. Each row is cellHeight + verticalMargin, until last one which has no margin below | ||
var cssMinHeight = parseInt(this.$el.css('min-height')); | ||
if (cssMinHeight > 0) { | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great, but all those need to be alphabetized please. also
row
should say something like:row
- fixed number of rows which prevents the grid from changing as items are added/removed/moved, Shortcut for settingminRow: N, maxRow: N
. default is0
no constrain. EXPERIMENTAL - seemaxRow