Sunday 14 February 2016

Jstree & DND Enable Drag and Drop Inside Only

Lesson learned today: To allow drag and drop in the wonderful Jstree, but disable nodes reordering (i.e. allow changing only parent change) you must use:

core : { check_callback : function (op, obj, par, pos, more) {
  if(more.dnd && more.pos !== "i") { return false; }
}
That's as per an answer given by Jstree author himself, Ivan Bozhanov:
https://groups.google.com/forum/#!topic/jstree/nn5GaA6WhXE