diff --git a/demo/column.html b/demo/column.html
index 0fe00de9a..25156d287 100644
--- a/demo/column.html
+++ b/demo/column.html
@@ -48,30 +48,30 @@
setColumn() grid demo
}
var items = [
- {x: 0, y: 4, width: 12, height: 1},
- {x: 5, y: 3, width: 2, height: 1},
- {x: 1, y: 3, width: 4, height: 1},
- {x: 0, y: 0, width: 1, height: 1},
- {}, // autoPosition testing
- {x: 5, y: 0, width: 1, height: 1},
+ {x: 0, y: 0, width: 2, height: 2},
{x: 2, y: 0, width: 2, height: 1},
- {x: 0, y: 0, width: 2, height: 2}
+ {x: 5, y: 0, width: 1, height: 1},
+ {text: ' auto'}, // autoPosition testing
+ {x: 1, y: 3, width: 4, height: 1},
+ {x: 5, y: 3, width: 2, height: 1},
+ {x: 0, y: 4, width: 12, height: 1}
];
var count = 0;
grid.batchUpdate();
for (count=0; count<3; count++) {
- grid.addWidget($(''), items.pop());
+ var n = items[count];
+ grid.addWidget($('' + count + (n.text ? n.text : '') + '
'), n);
};
grid.commit();
$('#add-widget').click(function() {
- var node = items.pop() || {
+ var n = items[count++] || {
x: Math.round(12 * Math.random()),
y: Math.round(5 * Math.random()),
width: Math.round(1 + 3 * Math.random()),
height: Math.round(1 + 3 * Math.random())
};
- grid.addWidget($(''), node);
+ grid.addWidget($('' + count + (n.text ? n.text : '') + '
'), n);
});
$('#1column').click(function() { grid.setColumn(1); });
diff --git a/demo/two.html b/demo/two.html
index c41c0bb12..907028062 100644
--- a/demo/two.html
+++ b/demo/two.html
@@ -74,11 +74,13 @@ Two grids demo
@@ -136,13 +138,21 @@
Two grids demo
appendTo: 'body',
});
- $('#float1').click(function() { toggleFloat('#float1', '#grid1'); });
- $('#float2').click(function() { toggleFloat('#float2', '#grid2'); });
+ $('#float1').click(function() { toggleFloat('#float1', '#grid1') });
+ $('#float2').click(function() { toggleFloat('#float2', '#grid2') });
function toggleFloat(button, grid) {
var grid = $(grid).data('gridstack');
grid.float(! grid.float());
$(button).html('float: ' + grid.float());
}
+
+ $('#compact1').click(function() { compact('#grid1') });
+ $('#compact2').click(function() { compact('#grid2') });
+ function compact(grid) {
+ var grid = $(grid).data('gridstack');
+ grid.compact();
+ }
+
});