The question of how many columns to display for the JQuery gridly control is displayed exactly according to the value of columns.
But showing columns is not a few columns for how many values to display. is still very vague at the moment. The official document does not give a specific explanation.
$ ('. gridly '). gridly ({base:60,//pxgutter:20,//Pxcolumns: $ ("#FormColumnCount"). Val () * 3,callbacks: {reordered:func tion ($elements) {//called after the drag and drop ends with the elements in their ending position.//current object var currentobj = This.reordered.arguments[1];var arr = $elements;//Previous object Var prevobj;//after an object var afterobj;for (i = 0; i < arr.length; i++) {$ (arr[i]). Find (' Input[name=sortby] '). Val ((i + 2) * 10);} Perform save sort, update data//sortdata ...}});
The code for determining the coordinates is as follows:
Gridly.prototype.position = function ($element, columns) { var column, height, I, j, K, Max, ref, REF1, Ref2, size;
size = This.size ($element); Height = Infinity; column = 0; for (i = j = 0, ref = columns.length-size; 0 <= ref. J < ref:j > ref; i = 0 <= ref? ++J:--j) { max = Math.max.apply (Math, Columns.slice (i, i + size)); if (max < height) { height = max; column = i; } } for (i = k = ref1 = column, ref2 = column + size; ref1 <= ref2? k < ref2:k > ref2; i = ref1 <= ref2? ++k: --k) { Columns[i] = height + ($element. Data (' height ') | | $element. outerheight ()) + This.settings.gutter; } return { X:column * (This.settings.base + this.settings.gutter), y:height }; };
The question of how many columns are displayed for the JQuery gridly control.