Skip to content
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

enabled auto-height feature #231

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions demo/main/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ angular.module('app')
if (viewValue === '' || viewValue === null || typeof viewValue === 'undefined') {
return null;
}
if (viewValue === 'a') {
return 'auto';
}
return parseInt(viewValue, 10);
});
}
Expand Down Expand Up @@ -38,9 +41,10 @@ angular.module('app')
col: 0
}, {
sizeX: 2,
sizeY: 2,
sizeY: 'auto',
row: 0,
col: 2
col: 2,
lines: 3
}, {
sizeX: 2,
sizeY: 1,
Expand Down Expand Up @@ -175,4 +179,7 @@ angular.module('app')
col: 'item.position[1]'
};

$scope.getList = function(num) {
return new Array(parseInt(num, 10) || 0);
}
});
5 changes: 4 additions & 1 deletion demo/main/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h2>Standard Items</h2>
<input type="text" ng-model="gridsterOpts.margins[1]" size="3" />

<p>
Each item provides its own dimensions and position using the standard fields: { row: row, col: col, sizeX: sizeX, sizeY: sizeY }.
Each item provides its own dimensions and position using the standard fields: { row: row, col: col, sizeX: sizeX, sizeY: sizeY, lines: lines }. sizeY could be 'a' for auto height.
</p>
<div gridster="gridsterOpts">
<ul>
Expand All @@ -22,6 +22,9 @@ <h2>Standard Items</h2>
<br />
<input type="text" integer ng-model="item.sizeX" size="1" />x
<input type="text" integer ng-model="item.sizeY" size="1" />
<br />
<input type="text" ng-model="item.lines" size="1" />
<p ng-if="item.lines > 0" ng-repeat="line in getList(item.lines) track by $index">{{$index+1}}</p>
</li>
</ul>
</div>
Expand Down
Loading