updated docs and dist

This commit is contained in:
vieron
2012-07-19 16:45:01 +02:00
parent 79bec6897f
commit f2356c8a08
5 changed files with 316 additions and 133 deletions

View File

@ -426,11 +426,13 @@
* the widget that was just created. * the widget that was just created.
*/ */
fn.add_widget = function(html, size_x, size_y) { fn.add_widget = function(html, size_x, size_y) {
var next_pos = this.next_position(size_x, size_y);
var $w = $(html).attr({ var $w = $(html).attr({
'data-col': this.highest_occupied_cell.col, 'data-col': next_pos.col,
'data-row': this.highest_occupied_cell.row + 1, 'data-row': next_pos.row,
'data-sizex' : size_x || 1, 'data-sizex' : next_pos.size_x,
'data-sizey' : size_y || 1 'data-sizey' : next_pos.size_y
}).addClass('gs_w').appendTo(this.$el).hide(); }).addClass('gs_w').appendTo(this.$el).hide();
this.$widgets = this.$widgets.add($w); this.$widgets = this.$widgets.add($w);
@ -456,6 +458,8 @@
* widget coords. * widget coords.
*/ */
fn.next_position = function(size_x, size_y) { fn.next_position = function(size_x, size_y) {
size_x || (size_x = 1);
size_y || (size_y = 1);
var ga = this.gridmap; var ga = this.gridmap;
var cols_l = ga.length; var cols_l = ga.length;
var valid_pos = []; var valid_pos = [];
@ -480,7 +484,8 @@
} }
if (valid_pos.length) { if (valid_pos.length) {
var next_position = this.sort_by_row_asc(valid_pos)[0]; var next_position = this.sort_by_row_asc(valid_pos);
next_position = this.sort_by_row_asc(next_position)[0];
return next_position; return next_position;
} }
return false; return false;
@ -973,6 +978,26 @@
}; };
/**
* Sorts an Array of grid coords objects by column (representing the grid
* coords of each widget) in ascending way.
*
* @method sort_by_row_asc
* @param {Array} widgets Array of grid coords objects
* @return {Array} Returns the array sorted.
*/
fn.sort_by_col_asc = function(widgets) {
widgets = widgets.sort(function(a, b){
if (a.col > b.col) {
return 1;
}
return -1;
});
return widgets;
};
/** /**
* Sorts an Array of grid coords objects (representing the grid coords of * Sorts an Array of grid coords objects (representing the grid coords of
* each widget) in descending way. * each widget) in descending way.
@ -2097,6 +2122,7 @@
fn.set_dom_grid_height = function() { fn.set_dom_grid_height = function() {
var r = this.get_highest_occupied_cell().row; var r = this.get_highest_occupied_cell().row;
this.$el.css('height', r * this.min_widget_height); this.$el.css('height', r * this.min_widget_height);
// this.$widgets.draggable("option", "containment", this.$el);
return this; return this;
}; };

File diff suppressed because one or more lines are too long

View File

@ -840,6 +840,13 @@
</li>
<li class="index-item method">
<a href="#method_sort_by_row_asc">sort_by_row_asc</a>
</li> </li>
<li class="index-item method"> <li class="index-item method">
@ -932,7 +939,7 @@
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1870"><code>src&#x2F;jquery.gridster.js:1870</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1896"><code>src&#x2F;jquery.gridster.js:1896</code></a>
</p> </p>
@ -1042,7 +1049,7 @@
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l334"><code>src&#x2F;jquery.gridster.js:334</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l339"><code>src&#x2F;jquery.gridster.js:339</code></a>
</p> </p>
@ -1310,7 +1317,7 @@
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l966"><code>src&#x2F;jquery.gridster.js:966</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l991"><code>src&#x2F;jquery.gridster.js:991</code></a>
</p> </p>
@ -1428,7 +1435,7 @@
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1373"><code>src&#x2F;jquery.gridster.js:1373</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1398"><code>src&#x2F;jquery.gridster.js:1398</code></a>
</p> </p>
@ -1565,7 +1572,7 @@ upper row possible.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1015"><code>src&#x2F;jquery.gridster.js:1015</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1040"><code>src&#x2F;jquery.gridster.js:1040</code></a>
</p> </p>
@ -1683,7 +1690,7 @@ upper row possible.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1545"><code>src&#x2F;jquery.gridster.js:1545</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1570"><code>src&#x2F;jquery.gridster.js:1570</code></a>
</p> </p>
@ -1810,7 +1817,7 @@ into account the dimensions (<code>size_y</code> and <code>size_x</code> attrs.
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l356"><code>src&#x2F;jquery.gridster.js:356</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l361"><code>src&#x2F;jquery.gridster.js:361</code></a>
</p> </p>
@ -1881,7 +1888,7 @@ into account the dimensions (<code>size_y</code> and <code>size_x</code> attrs.
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1508"><code>src&#x2F;jquery.gridster.js:1508</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1533"><code>src&#x2F;jquery.gridster.js:1533</code></a>
</p> </p>
@ -1968,7 +1975,7 @@ into account the dimensions (<code>size_y</code> and <code>size_x</code> attrs.
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1643"><code>src&#x2F;jquery.gridster.js:1643</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1668"><code>src&#x2F;jquery.gridster.js:1668</code></a>
</p> </p>
@ -2096,7 +2103,7 @@ each one.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1664"><code>src&#x2F;jquery.gridster.js:1664</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1689"><code>src&#x2F;jquery.gridster.js:1689</code></a>
</p> </p>
@ -2224,7 +2231,7 @@ each one.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1683"><code>src&#x2F;jquery.gridster.js:1683</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1708"><code>src&#x2F;jquery.gridster.js:1708</code></a>
</p> </p>
@ -2357,7 +2364,7 @@ each one.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1749"><code>src&#x2F;jquery.gridster.js:1749</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1774"><code>src&#x2F;jquery.gridster.js:1774</code></a>
</p> </p>
@ -2504,7 +2511,7 @@ iteration. The value of <code>this</code> inside the function is the jQuery wrap
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1765"><code>src&#x2F;jquery.gridster.js:1765</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1790"><code>src&#x2F;jquery.gridster.js:1790</code></a>
</p> </p>
@ -2645,7 +2652,7 @@ iteration. The value of <code>this</code> inside the function is the jQuery wrap
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1893"><code>src&#x2F;jquery.gridster.js:1893</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1919"><code>src&#x2F;jquery.gridster.js:1919</code></a>
</p> </p>
@ -2755,7 +2762,7 @@ detect row or column that we want to go.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1967"><code>src&#x2F;jquery.gridster.js:1967</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1993"><code>src&#x2F;jquery.gridster.js:1993</code></a>
</p> </p>
@ -2843,7 +2850,7 @@ detect row or column that we want to go.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1826"><code>src&#x2F;jquery.gridster.js:1826</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1852"><code>src&#x2F;jquery.gridster.js:1852</code></a>
</p> </p>
@ -2962,7 +2969,7 @@ detect row or column that we want to go.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1615"><code>src&#x2F;jquery.gridster.js:1615</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1640"><code>src&#x2F;jquery.gridster.js:1640</code></a>
</p> </p>
@ -3056,7 +3063,7 @@ detect row or column that we want to go.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1781"><code>src&#x2F;jquery.gridster.js:1781</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1806"><code>src&#x2F;jquery.gridster.js:1806</code></a>
</p> </p>
@ -3137,7 +3144,7 @@ detect row or column that we want to go.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1580"><code>src&#x2F;jquery.gridster.js:1580</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1605"><code>src&#x2F;jquery.gridster.js:1605</code></a>
</p> </p>
@ -3242,7 +3249,7 @@ detect row or column that we want to go.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1598"><code>src&#x2F;jquery.gridster.js:1598</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1623"><code>src&#x2F;jquery.gridster.js:1623</code></a>
</p> </p>
@ -3359,7 +3366,7 @@ detect row or column that we want to go.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1066"><code>src&#x2F;jquery.gridster.js:1066</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1091"><code>src&#x2F;jquery.gridster.js:1091</code></a>
</p> </p>
@ -3487,7 +3494,7 @@ the</code>upper<em>rows<code>array. Iteration starts from row specified in</code
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1953"><code>src&#x2F;jquery.gridster.js:1953</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1979"><code>src&#x2F;jquery.gridster.js:1979</code></a>
</p> </p>
@ -3558,7 +3565,7 @@ the</code>upper<em>rows<code>array. Iteration starts from row specified in</code
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1144"><code>src&#x2F;jquery.gridster.js:1144</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1169"><code>src&#x2F;jquery.gridster.js:1169</code></a>
</p> </p>
@ -3629,7 +3636,7 @@ the</code>upper<em>rows<code>array. Iteration starts from row specified in</code
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l902"><code>src&#x2F;jquery.gridster.js:902</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l927"><code>src&#x2F;jquery.gridster.js:927</code></a>
</p> </p>
@ -3716,7 +3723,7 @@ the</code>upper<em>rows<code>array. Iteration starts from row specified in</code
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l821"><code>src&#x2F;jquery.gridster.js:821</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l846"><code>src&#x2F;jquery.gridster.js:846</code></a>
</p> </p>
@ -3841,7 +3848,7 @@ the</code>upper<em>rows<code>array. Iteration starts from row specified in</code
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l840"><code>src&#x2F;jquery.gridster.js:840</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l865"><code>src&#x2F;jquery.gridster.js:865</code></a>
</p> </p>
@ -3966,7 +3973,7 @@ the</code>upper<em>rows<code>array. Iteration starts from row specified in</code
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l795"><code>src&#x2F;jquery.gridster.js:795</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l820"><code>src&#x2F;jquery.gridster.js:820</code></a>
</p> </p>
@ -4085,7 +4092,7 @@ the</code>upper<em>rows<code>array. Iteration starts from row specified in</code
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l809"><code>src&#x2F;jquery.gridster.js:809</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l834"><code>src&#x2F;jquery.gridster.js:834</code></a>
</p> </p>
@ -4195,7 +4202,7 @@ the</code>upper<em>rows<code>array. Iteration starts from row specified in</code
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l763"><code>src&#x2F;jquery.gridster.js:763</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l788"><code>src&#x2F;jquery.gridster.js:788</code></a>
</p> </p>
@ -4323,7 +4330,7 @@ HTMLElements.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l780"><code>src&#x2F;jquery.gridster.js:780</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l805"><code>src&#x2F;jquery.gridster.js:805</code></a>
</p> </p>
@ -4449,7 +4456,7 @@ and col given.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l860"><code>src&#x2F;jquery.gridster.js:860</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l885"><code>src&#x2F;jquery.gridster.js:885</code></a>
</p> </p>
@ -4575,7 +4582,7 @@ else returns the jQuery HTMLElement
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l885"><code>src&#x2F;jquery.gridster.js:885</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l910"><code>src&#x2F;jquery.gridster.js:910</code></a>
</p> </p>
@ -4707,7 +4714,7 @@ params and if this is under the widget that is being dragged.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l717"><code>src&#x2F;jquery.gridster.js:717</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l742"><code>src&#x2F;jquery.gridster.js:742</code></a>
</p> </p>
@ -4849,7 +4856,7 @@ each widget) in descending way.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1328"><code>src&#x2F;jquery.gridster.js:1328</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1353"><code>src&#x2F;jquery.gridster.js:1353</code></a>
</p> </p>
@ -4968,7 +4975,7 @@ each widget) in descending way.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1239"><code>src&#x2F;jquery.gridster.js:1239</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1264"><code>src&#x2F;jquery.gridster.js:1264</code></a>
</p> </p>
@ -5080,7 +5087,7 @@ if they can.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1282"><code>src&#x2F;jquery.gridster.js:1282</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1307"><code>src&#x2F;jquery.gridster.js:1307</code></a>
</p> </p>
@ -5206,7 +5213,7 @@ if they can.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l171"><code>src&#x2F;jquery.gridster.js:171</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l173"><code>src&#x2F;jquery.gridster.js:173</code></a>
</p> </p>
@ -5328,7 +5335,7 @@ if they can.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l436"><code>src&#x2F;jquery.gridster.js:436</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l441"><code>src&#x2F;jquery.gridster.js:441</code></a>
</p> </p>
@ -5441,7 +5448,7 @@ if they can.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l513"><code>src&#x2F;jquery.gridster.js:513</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l518"><code>src&#x2F;jquery.gridster.js:518</code></a>
</p> </p>
@ -5569,7 +5576,7 @@ overlapped or stops being overlapped.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l553"><code>src&#x2F;jquery.gridster.js:553</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l558"><code>src&#x2F;jquery.gridster.js:558</code></a>
</p> </p>
@ -5693,7 +5700,7 @@ overlapped or stops being overlapped.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l387"><code>src&#x2F;jquery.gridster.js:387</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l392"><code>src&#x2F;jquery.gridster.js:392</code></a>
</p> </p>
@ -5800,7 +5807,7 @@ overlapped or stops being overlapped.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1177"><code>src&#x2F;jquery.gridster.js:1177</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1202"><code>src&#x2F;jquery.gridster.js:1202</code></a>
</p> </p>
@ -5904,7 +5911,7 @@ overlapped or stops being overlapped.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1189"><code>src&#x2F;jquery.gridster.js:1189</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1214"><code>src&#x2F;jquery.gridster.js:1214</code></a>
</p> </p>
@ -6010,7 +6017,7 @@ overlapped or stops being overlapped.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l462"><code>src&#x2F;jquery.gridster.js:462</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l467"><code>src&#x2F;jquery.gridster.js:467</code></a>
</p> </p>
@ -6117,7 +6124,7 @@ overlapped or stops being overlapped.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1201"><code>src&#x2F;jquery.gridster.js:1201</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1226"><code>src&#x2F;jquery.gridster.js:1226</code></a>
</p> </p>
@ -6221,7 +6228,7 @@ overlapped or stops being overlapped.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1219"><code>src&#x2F;jquery.gridster.js:1219</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1244"><code>src&#x2F;jquery.gridster.js:1244</code></a>
</p> </p>
@ -6315,7 +6322,7 @@ overlapped or stops being overlapped.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1929"><code>src&#x2F;jquery.gridster.js:1929</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1955"><code>src&#x2F;jquery.gridster.js:1955</code></a>
</p> </p>
@ -6387,7 +6394,7 @@ the browser is resized.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l272"><code>src&#x2F;jquery.gridster.js:272</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l277"><code>src&#x2F;jquery.gridster.js:277</code></a>
</p> </p>
@ -6469,7 +6476,7 @@ mapped array of positions.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l321"><code>src&#x2F;jquery.gridster.js:321</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l326"><code>src&#x2F;jquery.gridster.js:326</code></a>
</p> </p>
@ -6574,7 +6581,7 @@ mapped array of positions.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l212"><code>src&#x2F;jquery.gridster.js:212</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l217"><code>src&#x2F;jquery.gridster.js:217</code></a>
</p> </p>
@ -6678,7 +6685,7 @@ mapped array of positions.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l238"><code>src&#x2F;jquery.gridster.js:238</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l243"><code>src&#x2F;jquery.gridster.js:243</code></a>
</p> </p>
@ -6776,7 +6783,7 @@ mapped array of positions.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l260"><code>src&#x2F;jquery.gridster.js:260</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l265"><code>src&#x2F;jquery.gridster.js:265</code></a>
</p> </p>
@ -6864,7 +6871,7 @@ mapped array of positions.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1491"><code>src&#x2F;jquery.gridster.js:1491</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1516"><code>src&#x2F;jquery.gridster.js:1516</code></a>
</p> </p>
@ -6973,7 +6980,7 @@ mapped array of positions.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1813"><code>src&#x2F;jquery.gridster.js:1813</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1838"><code>src&#x2F;jquery.gridster.js:1838</code></a>
</p> </p>
@ -7060,7 +7067,7 @@ mapped array of positions.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l924"><code>src&#x2F;jquery.gridster.js:924</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l949"><code>src&#x2F;jquery.gridster.js:949</code></a>
</p> </p>
@ -7187,7 +7194,7 @@ mapped array of positions.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l589"><code>src&#x2F;jquery.gridster.js:589</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l594"><code>src&#x2F;jquery.gridster.js:594</code></a>
</p> </p>
@ -7308,7 +7315,7 @@ mapped array of positions.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l678"><code>src&#x2F;jquery.gridster.js:678</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l683"><code>src&#x2F;jquery.gridster.js:683</code></a>
</p> </p>
@ -7364,6 +7371,111 @@ each widget) in ascending way.</p>
</div>
<div id="method_sort_by_row_asc" class="method item">
<h3 class="name"><code>sort_by_row_asc</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>widgets</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type">Array</span>
</span>
<div class="meta">
<p>
Defined in
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l703"><code>src&#x2F;jquery.gridster.js:703</code></a>
</p>
</div>
<div class="description">
<p>Sorts an Array of grid coords objects by column (representing the grid
coords of each widget) in ascending way.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">widgets</code>
<span class="type">Array</span>
<div class="param-description">
<p>Array of grid coords objects</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Array</span>:
Returns the array sorted.
</div>
</div>
</div> </div>
@ -7413,7 +7525,7 @@ each widget) in ascending way.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l698"><code>src&#x2F;jquery.gridster.js:698</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l723"><code>src&#x2F;jquery.gridster.js:723</code></a>
</p> </p>
@ -7524,7 +7636,7 @@ each widget) in descending way.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l300"><code>src&#x2F;jquery.gridster.js:300</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l305"><code>src&#x2F;jquery.gridster.js:305</code></a>
</p> </p>
@ -7647,7 +7759,7 @@ the grid coords object passed in the <code>grid_data</code> param.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1462"><code>src&#x2F;jquery.gridster.js:1462</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l1487"><code>src&#x2F;jquery.gridster.js:1487</code></a>
</p> </p>
@ -7751,7 +7863,7 @@ the grid coords object passed in the <code>grid_data</code> param.</p>
<a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l642"><code>src&#x2F;jquery.gridster.js:642</code></a> <a href="..&#x2F;files&#x2F;src_jquery.gridster.js.html#l647"><code>src&#x2F;jquery.gridster.js:647</code></a>
</p> </p>

View File

@ -244,7 +244,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 171, "line": 173,
"description": "Get the most left column below to add a new widget.", "description": "Get the most left column below to add a new widget.",
"itemtype": "method", "itemtype": "method",
"name": "next_position", "name": "next_position",
@ -268,7 +268,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 212, "line": 217,
"description": "Remove a widget from the grid.", "description": "Remove a widget from the grid.",
"itemtype": "method", "itemtype": "method",
"name": "remove_widget", "name": "remove_widget",
@ -287,7 +287,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 238, "line": 243,
"description": "Returns a serialized array of the widgets in the grid.", "description": "Returns a serialized array of the widgets in the grid.",
"itemtype": "method", "itemtype": "method",
"name": "serialize", "name": "serialize",
@ -307,7 +307,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 260, "line": 265,
"description": "Returns a serialized array of the widgets that have changed their position.", "description": "Returns a serialized array of the widgets that have changed their position.",
"itemtype": "method", "itemtype": "method",
"name": "serialize_changed", "name": "serialize_changed",
@ -319,7 +319,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 272, "line": 277,
"description": "Creates the grid coords object representing the widget a add it to the\nmapped array of positions.", "description": "Creates the grid coords object representing the widget a add it to the\nmapped array of positions.",
"itemtype": "method", "itemtype": "method",
"name": "register_widget", "name": "register_widget",
@ -331,7 +331,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 300, "line": 305,
"description": "Update in the mapped array of positions the value of cells represented by\nthe grid coords object passed in the `grid_data` param.", "description": "Update in the mapped array of positions the value of cells represented by\nthe grid coords object passed in the `grid_data` param.",
"params": [ "params": [
{ {
@ -355,7 +355,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 321, "line": 326,
"description": "Remove a widget from the mapped array of positions.", "description": "Remove a widget from the mapped array of positions.",
"itemtype": "method", "itemtype": "method",
"name": "remove_from_gridmap", "name": "remove_from_gridmap",
@ -374,7 +374,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 334, "line": 339,
"description": "Add a widget to the mapped array of positions.", "description": "Add a widget to the mapped array of positions.",
"itemtype": "method", "itemtype": "method",
"name": "add_to_gridmap", "name": "add_to_gridmap",
@ -398,7 +398,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 356, "line": 361,
"description": "Make widgets draggable. It Wraps the jQuery UI Draggable Plugin.", "description": "Make widgets draggable. It Wraps the jQuery UI Draggable Plugin.",
"itemtype": "method", "itemtype": "method",
"name": "draggable", "name": "draggable",
@ -410,7 +410,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 387, "line": 392,
"description": "This function is executed when the player begins to be dragged.", "description": "This function is executed when the player begins to be dragged.",
"itemtype": "method", "itemtype": "method",
"name": "on_start_drag", "name": "on_start_drag",
@ -430,7 +430,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 436, "line": 441,
"description": "This function is executed when the player is being dragged.", "description": "This function is executed when the player is being dragged.",
"itemtype": "method", "itemtype": "method",
"name": "on_drag", "name": "on_drag",
@ -450,7 +450,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 462, "line": 467,
"description": "This function is executed when the player stops being dragged.", "description": "This function is executed when the player stops being dragged.",
"itemtype": "method", "itemtype": "method",
"name": "on_stop_drag", "name": "on_stop_drag",
@ -470,7 +470,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 513, "line": 518,
"description": "Executes the callbacks passed as arguments when a column begins to be\noverlapped or stops being overlapped.", "description": "Executes the callbacks passed as arguments when a column begins to be\noverlapped or stops being overlapped.",
"params": [ "params": [
{ {
@ -494,7 +494,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 553, "line": 558,
"description": "Executes the callbacks passed as arguments when a row starts to be\noverlapped or stops being overlapped.", "description": "Executes the callbacks passed as arguments when a row starts to be\noverlapped or stops being overlapped.",
"params": [ "params": [
{ {
@ -518,7 +518,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 589, "line": 594,
"description": "Sets the current position of the player", "description": "Sets the current position of the player",
"params": [ "params": [
{ {
@ -542,7 +542,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 642, "line": 647,
"description": "See which of the widgets in the $widgets param collection can go to\na upper row and which not.", "description": "See which of the widgets in the $widgets param collection can go to\na upper row and which not.",
"itemtype": "method", "itemtype": "method",
"name": "widgets_contraints", "name": "widgets_contraints",
@ -561,7 +561,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 678, "line": 683,
"description": "Sorts an Array of grid coords objects (representing the grid coords of\neach widget) in ascending way.", "description": "Sorts an Array of grid coords objects (representing the grid coords of\neach widget) in ascending way.",
"itemtype": "method", "itemtype": "method",
"name": "sort_by_row_asc", "name": "sort_by_row_asc",
@ -580,7 +580,26 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 698, "line": 703,
"description": "Sorts an Array of grid coords objects by column (representing the grid\ncoords of each widget) in ascending way.",
"itemtype": "method",
"name": "sort_by_row_asc",
"params": [
{
"name": "widgets",
"description": "Array of grid coords objects",
"type": "Array"
}
],
"return": {
"description": "Returns the array sorted.",
"type": "Array"
},
"class": "Gridster"
},
{
"file": "src/jquery.gridster.js",
"line": 723,
"description": "Sorts an Array of grid coords objects (representing the grid coords of\neach widget) in descending way.", "description": "Sorts an Array of grid coords objects (representing the grid coords of\neach widget) in descending way.",
"itemtype": "method", "itemtype": "method",
"name": "sort_by_row_desc", "name": "sort_by_row_desc",
@ -599,7 +618,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 717, "line": 742,
"description": "Sorts an Array of grid coords objects (representing the grid coords of\neach widget) in descending way.", "description": "Sorts an Array of grid coords objects (representing the grid coords of\neach widget) in descending way.",
"itemtype": "method", "itemtype": "method",
"name": "manage_movements", "name": "manage_movements",
@ -628,7 +647,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 763, "line": 788,
"description": "Determines if there is a widget in the row and col given. Or if the\nHTMLElement passed as first argument is the player.", "description": "Determines if there is a widget in the row and col given. Or if the\nHTMLElement passed as first argument is the player.",
"itemtype": "method", "itemtype": "method",
"name": "is_player", "name": "is_player",
@ -653,7 +672,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 780, "line": 805,
"description": "Determines if the widget that is being dragged is currently over the row\nand col given.", "description": "Determines if the widget that is being dragged is currently over the row\nand col given.",
"itemtype": "method", "itemtype": "method",
"name": "is_player_in", "name": "is_player_in",
@ -677,7 +696,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 795, "line": 820,
"description": "Determines if the placeholder is currently over the row and col given.", "description": "Determines if the placeholder is currently over the row and col given.",
"itemtype": "method", "itemtype": "method",
"name": "is_placeholder_in", "name": "is_placeholder_in",
@ -701,7 +720,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 809, "line": 834,
"description": "Determines if the placeholder is currently over the column given.", "description": "Determines if the placeholder is currently over the column given.",
"itemtype": "method", "itemtype": "method",
"name": "is_placeholder_in_col", "name": "is_placeholder_in_col",
@ -720,7 +739,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 821, "line": 846,
"description": "Determines if the cell represented by col and row params is empty.", "description": "Determines if the cell represented by col and row params is empty.",
"itemtype": "method", "itemtype": "method",
"name": "is_empty", "name": "is_empty",
@ -744,7 +763,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 840, "line": 865,
"description": "Determines if the cell represented by col and row params is occupied.", "description": "Determines if the cell represented by col and row params is occupied.",
"itemtype": "method", "itemtype": "method",
"name": "is_occupied", "name": "is_occupied",
@ -768,7 +787,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 860, "line": 885,
"description": "Determines if there is a widget in the cell represented by col/row params.", "description": "Determines if there is a widget in the cell represented by col/row params.",
"itemtype": "method", "itemtype": "method",
"name": "is_widget", "name": "is_widget",
@ -792,7 +811,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 885, "line": 910,
"description": "Determines if there is a widget in the cell represented by col/row\nparams and if this is under the widget that is being dragged.", "description": "Determines if there is a widget in the cell represented by col/row\nparams and if this is under the widget that is being dragged.",
"itemtype": "method", "itemtype": "method",
"name": "is_widget_under_player", "name": "is_widget_under_player",
@ -816,7 +835,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 902, "line": 927,
"description": "Get widgets overlapping with the player.", "description": "Get widgets overlapping with the player.",
"itemtype": "method", "itemtype": "method",
"name": "get_widgets_under_player", "name": "get_widgets_under_player",
@ -828,7 +847,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 924, "line": 949,
"description": "Put placeholder at the row and column specified.", "description": "Put placeholder at the row and column specified.",
"itemtype": "method", "itemtype": "method",
"name": "set_placeholder", "name": "set_placeholder",
@ -852,7 +871,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 966, "line": 991,
"description": "Determines whether the player can move to a position above.", "description": "Determines whether the player can move to a position above.",
"itemtype": "method", "itemtype": "method",
"name": "can_go_player_up", "name": "can_go_player_up",
@ -871,7 +890,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1015, "line": 1040,
"description": "Determines whether a widget can move to a position above.", "description": "Determines whether a widget can move to a position above.",
"itemtype": "method", "itemtype": "method",
"name": "can_go_widget_up", "name": "can_go_widget_up",
@ -890,7 +909,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1066, "line": 1091,
"description": "Search a valid row for the widget represented by `widget_grid_data' in\nthe `upper_rows` array. Iteration starts from row specified in `min_row`.", "description": "Search a valid row for the widget represented by `widget_grid_data' in\nthe `upper_rows` array. Iteration starts from row specified in `min_row`.",
"itemtype": "method", "itemtype": "method",
"name": "get_valid_rows", "name": "get_valid_rows",
@ -919,7 +938,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1144, "line": 1169,
"description": "Get widgets overlapping with the player.", "description": "Get widgets overlapping with the player.",
"itemtype": "method", "itemtype": "method",
"name": "get_widgets_overlapped", "name": "get_widgets_overlapped",
@ -931,7 +950,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1177, "line": 1202,
"description": "This callback is executed when the player begins to collide with a column.", "description": "This callback is executed when the player begins to collide with a column.",
"itemtype": "method", "itemtype": "method",
"name": "on_start_overlapping_column", "name": "on_start_overlapping_column",
@ -950,7 +969,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1189, "line": 1214,
"description": "A callback executed when the player begins to collide with a row.", "description": "A callback executed when the player begins to collide with a row.",
"itemtype": "method", "itemtype": "method",
"name": "on_start_overlapping_row", "name": "on_start_overlapping_row",
@ -969,7 +988,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1201, "line": 1226,
"description": "A callback executed when the the player ends to collide with a column.", "description": "A callback executed when the the player ends to collide with a column.",
"itemtype": "method", "itemtype": "method",
"name": "on_stop_overlapping_column", "name": "on_stop_overlapping_column",
@ -988,7 +1007,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1219, "line": 1244,
"description": "This callback is executed when the player ends to collide with a row.", "description": "This callback is executed when the player ends to collide with a row.",
"itemtype": "method", "itemtype": "method",
"name": "on_stop_overlapping_row", "name": "on_stop_overlapping_row",
@ -1007,7 +1026,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1239, "line": 1264,
"description": "Move a widget to a specific row. The cell or cells must be empty.\nIf the widget has widgets below, all of these widgets will be moved also\nif they can.", "description": "Move a widget to a specific row. The cell or cells must be empty.\nIf the widget has widgets below, all of these widgets will be moved also\nif they can.",
"itemtype": "method", "itemtype": "method",
"name": "move_widget_to", "name": "move_widget_to",
@ -1026,7 +1045,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1282, "line": 1307,
"description": "Move up the specified widget and all below it.", "description": "Move up the specified widget and all below it.",
"itemtype": "method", "itemtype": "method",
"name": "move_widget_up", "name": "move_widget_up",
@ -1051,7 +1070,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1328, "line": 1353,
"description": "Move down the specified widget and all below it.", "description": "Move down the specified widget and all below it.",
"itemtype": "method", "itemtype": "method",
"name": "move_widget_down", "name": "move_widget_down",
@ -1075,7 +1094,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1373, "line": 1398,
"description": "Check if the widget can move to the specified row, else returns the\nupper row possible.", "description": "Check if the widget can move to the specified row, else returns the\nupper row possible.",
"itemtype": "method", "itemtype": "method",
"name": "can_go_up_to_row", "name": "can_go_up_to_row",
@ -1104,7 +1123,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1462, "line": 1487,
"description": "Get widgets below a widget.", "description": "Get widgets below a widget.",
"itemtype": "method", "itemtype": "method",
"name": "widgets_below", "name": "widgets_below",
@ -1123,7 +1142,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1491, "line": 1516,
"description": "Update the array of mapped positions with the new player position.", "description": "Update the array of mapped positions with the new player position.",
"itemtype": "method", "itemtype": "method",
"name": "set_cells_player_occupies", "name": "set_cells_player_occupies",
@ -1147,7 +1166,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1508, "line": 1533,
"description": "Remove from the array of mapped positions the reference to the player.", "description": "Remove from the array of mapped positions the reference to the player.",
"itemtype": "method", "itemtype": "method",
"name": "empty_cells_player_occupies", "name": "empty_cells_player_occupies",
@ -1159,7 +1178,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1545, "line": 1570,
"description": "Check if it's possible to move a widget to a specific col/row. It takes\ninto account the dimensions (`size_y` and `size_x` attrs. of the grid coords\n object) the widget occupies.", "description": "Check if it's possible to move a widget to a specific col/row. It takes\ninto account the dimensions (`size_y` and `size_x` attrs. of the grid coords\n object) the widget occupies.",
"itemtype": "method", "itemtype": "method",
"name": "can_move_to", "name": "can_move_to",
@ -1188,7 +1207,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1580, "line": 1605,
"description": "Given the leftmost column returns all columns that are overlapping with the player.", "description": "Given the leftmost column returns all columns that are overlapping with the player.",
"itemtype": "method", "itemtype": "method",
"name": "get_targeted_columns", "name": "get_targeted_columns",
@ -1208,7 +1227,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1598, "line": 1623,
"description": "Given the upper row returns all rows that are overlapping with the player.", "description": "Given the upper row returns all rows that are overlapping with the player.",
"itemtype": "method", "itemtype": "method",
"name": "get_targeted_rows", "name": "get_targeted_rows",
@ -1228,7 +1247,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1615, "line": 1640,
"description": "Get all columns and rows that a widget occupies.", "description": "Get all columns and rows that a widget occupies.",
"itemtype": "method", "itemtype": "method",
"name": "get_cells_occupied", "name": "get_cells_occupied",
@ -1247,7 +1266,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1643, "line": 1668,
"description": "Iterate over the cells occupied by a widget executing a function for\neach one.", "description": "Iterate over the cells occupied by a widget executing a function for\neach one.",
"itemtype": "method", "itemtype": "method",
"name": "for_each_cell_occupied", "name": "for_each_cell_occupied",
@ -1271,7 +1290,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1664, "line": 1689,
"description": "Iterate over the columns occupied by a widget executing a function for\neach one.", "description": "Iterate over the columns occupied by a widget executing a function for\neach one.",
"itemtype": "method", "itemtype": "method",
"name": "for_each_column_occupied", "name": "for_each_column_occupied",
@ -1295,7 +1314,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1683, "line": 1708,
"description": "Iterate over the rows occupied by a widget executing a function for\neach one.", "description": "Iterate over the rows occupied by a widget executing a function for\neach one.",
"itemtype": "method", "itemtype": "method",
"name": "for_each_row_occupied", "name": "for_each_row_occupied",
@ -1319,7 +1338,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1749, "line": 1774,
"description": "Iterate over each widget above the column and row specified.", "description": "Iterate over each widget above the column and row specified.",
"itemtype": "method", "itemtype": "method",
"name": "for_each_widget_above", "name": "for_each_widget_above",
@ -1348,7 +1367,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1765, "line": 1790,
"description": "Iterate over each widget below the column and row specified.", "description": "Iterate over each widget below the column and row specified.",
"itemtype": "method", "itemtype": "method",
"name": "for_each_widget_below", "name": "for_each_widget_below",
@ -1377,7 +1396,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1781, "line": 1806,
"description": "Returns the highest occupied cell in the grid.", "description": "Returns the highest occupied cell in the grid.",
"itemtype": "method", "itemtype": "method",
"name": "get_highest_occupied_cell", "name": "get_highest_occupied_cell",
@ -1389,7 +1408,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1813, "line": 1838,
"description": "Set the current height of the parent grid.", "description": "Set the current height of the parent grid.",
"itemtype": "method", "itemtype": "method",
"name": "set_dom_grid_height", "name": "set_dom_grid_height",
@ -1401,7 +1420,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1826, "line": 1852,
"description": "It generates the neccessary styles to position the widgets.", "description": "It generates the neccessary styles to position the widgets.",
"itemtype": "method", "itemtype": "method",
"name": "generate_stylesheet", "name": "generate_stylesheet",
@ -1425,7 +1444,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1870, "line": 1896,
"description": "Injects the given CSS as string to the head of the document.", "description": "Injects the given CSS as string to the head of the document.",
"itemtype": "method", "itemtype": "method",
"name": "add_style_tag", "name": "add_style_tag",
@ -1444,7 +1463,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1893, "line": 1919,
"description": "Generates a faux grid to collide with it when a widget is dragged and\ndetect row or column that we want to go.", "description": "Generates a faux grid to collide with it when a widget is dragged and\ndetect row or column that we want to go.",
"itemtype": "method", "itemtype": "method",
"name": "generate_faux_grid", "name": "generate_faux_grid",
@ -1468,7 +1487,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1929, "line": 1955,
"description": "Recalculates the offsets for the faux grid. You need to use it when\nthe browser is resized.", "description": "Recalculates the offsets for the faux grid. You need to use it when\nthe browser is resized.",
"itemtype": "method", "itemtype": "method",
"name": "recalculate_faux_grid", "name": "recalculate_faux_grid",
@ -1480,7 +1499,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1953, "line": 1979,
"description": "Get all widgets in the DOM and register them.", "description": "Get all widgets in the DOM and register them.",
"itemtype": "method", "itemtype": "method",
"name": "get_widgets_from_DOM", "name": "get_widgets_from_DOM",
@ -1492,7 +1511,7 @@
}, },
{ {
"file": "src/jquery.gridster.js", "file": "src/jquery.gridster.js",
"line": 1967, "line": 1993,
"description": "Calculate columns and rows to be set based on the configuration\n parameters, grid dimensions, etc ...", "description": "Calculate columns and rows to be set based on the configuration\n parameters, grid dimensions, etc ...",
"itemtype": "method", "itemtype": "method",
"name": "generate_grid_and_stylesheet", "name": "generate_grid_and_stylesheet",

View File

@ -241,11 +241,13 @@
* the widget that was just created. * the widget that was just created.
*&#x2F; *&#x2F;
fn.add_widget = function(html, size_x, size_y) { fn.add_widget = function(html, size_x, size_y) {
var next_pos = this.next_position(size_x, size_y);
var $w = $(html).attr({ var $w = $(html).attr({
&#x27;data-col&#x27;: this.highest_occupied_cell.col, &#x27;data-col&#x27;: next_pos.col,
&#x27;data-row&#x27;: this.highest_occupied_cell.row + 1, &#x27;data-row&#x27;: next_pos.row,
&#x27;data-sizex&#x27; : size_x || 1, &#x27;data-sizex&#x27; : next_pos.size_x,
&#x27;data-sizey&#x27; : size_y || 1 &#x27;data-sizey&#x27; : next_pos.size_y
}).addClass(&#x27;gs_w&#x27;).appendTo(this.$el).hide(); }).addClass(&#x27;gs_w&#x27;).appendTo(this.$el).hide();
this.$widgets = this.$widgets.add($w); this.$widgets = this.$widgets.add($w);
@ -271,6 +273,8 @@
* widget coords. * widget coords.
*&#x2F; *&#x2F;
fn.next_position = function(size_x, size_y) { fn.next_position = function(size_x, size_y) {
size_x || (size_x = 1);
size_y || (size_y = 1);
var ga = this.gridmap; var ga = this.gridmap;
var cols_l = ga.length; var cols_l = ga.length;
var valid_pos = []; var valid_pos = [];
@ -295,7 +299,8 @@
} }
if (valid_pos.length) { if (valid_pos.length) {
var next_position = this.sort_by_row_asc(valid_pos)[0]; var next_position = this.sort_by_row_asc(valid_pos);
next_position = this.sort_by_row_asc(next_position)[0];
return next_position; return next_position;
} }
return false; return false;
@ -788,6 +793,26 @@
}; };
&#x2F;**
* Sorts an Array of grid coords objects by column (representing the grid
* coords of each widget) in ascending way.
*
* @method sort_by_row_asc
* @param {Array} widgets Array of grid coords objects
* @return {Array} Returns the array sorted.
*&#x2F;
fn.sort_by_col_asc = function(widgets) {
widgets = widgets.sort(function(a, b){
if (a.col &gt; b.col) {
return 1;
}
return -1;
});
return widgets;
};
&#x2F;** &#x2F;**
* Sorts an Array of grid coords objects (representing the grid coords of * Sorts an Array of grid coords objects (representing the grid coords of
* each widget) in descending way. * each widget) in descending way.
@ -1912,6 +1937,7 @@
fn.set_dom_grid_height = function() { fn.set_dom_grid_height = function() {
var r = this.get_highest_occupied_cell().row; var r = this.get_highest_occupied_cell().row;
this.$el.css(&#x27;height&#x27;, r * this.min_widget_height); this.$el.css(&#x27;height&#x27;, r * this.min_widget_height);
&#x2F;&#x2F; this.$widgets.draggable(&quot;option&quot;, &quot;containment&quot;, this.$el);
return this; return this;
}; };