neokoenig / jQuery-gridmanager

A way of building rows and grids with built in editable regions; requires jQuery, jQueryUI, Bootstrap 3.x, & optional TinyMCE or CKEditor
http://neokoenig.github.io/jQuery-gridmanager/
461 stars 129 forks source link

How to drag blocks across rows. #59

Closed MwirabuaTimothy closed 9 years ago

MwirabuaTimothy commented 9 years ago

Apparently I can only drag blocks within the same row but not into other rows. How can I allow dragging to and from anywhere?

neokoenig commented 9 years ago

That's by design at the moment, as I found being able to drag columns out of their parent containers caused a fair few issues in terms of UI.

If you really want to try it, look at the gm.initCanvas function; specifically, you could try removing the 'containment: $(val)' argument on the $.each(rows) loop. Disclaimer, haven't tried it.

MwirabuaTimothy commented 9 years ago

Great. It seems you have to call the sortable function from the canvas level, but now from a different tag:

// Make Rows sortable canvas.sortable({ // the canvas variable references the $('#gm-canvas') tag items: rows, axis: 'y', placeholder: gm.options.rowSortingClass, handle: ".gm-moveRow", forcePlaceholderSize: true, opacity: 0.7, revert: true, tolerance: "pointer", cursor: "move" });

//Make columns sortable $('#mycanvas').sortable({ items: '.column', handle: ".gm-moveCol", forcePlaceholderSize: true, opacity: 0.7, revert: true, tolerance: "pointer", cursor: "move" });