I have 37 different node types.
I am trying to implement drag and drop.
This works but I need to restrict exactly which types can be dragged and where they can be dropped.
I can't find any useful information in the docs unfortunately (http://www.jstree.com/documentation).
So far I have tried three methods:
first: defining return values of true or false in the drag_check callback depending on the node type:
$("#demo1").jstree({
"dnd" : {
"drag_check" : function () {
second: binding to the prepare_move.jstree event and returning true or false values depending on the node type:
.bind("prepare_move.jstree", function (e, data) {
if (data.rslt.o.attr("typ") === "tpop") {
third: using the types plugin and defining valid children there:
$("#tree").jstree( {
"types": {
"type_attr": "typ",
"valid_children": ["ap_ordner_pop", "ap_ordner_apziel", "ap_ordner_erfkrit", "ap_ordner_apber", "ap_ordner_ber", "ap_ordner_beob", "iballg", "ap_ordner_ibb", "ap_ordner_ibartenassoz"],
"types": {
"ap_ordner_pop": {
"valid_children": "pop"
},
"pop": {
"valid_children": ["pop_ordner_tpop", "pop_ordner_popber", "pop_ordner_massnber"],
"new_node": "neue Population"
},
"pop_ordner_tpop": {
"valid_children": "tpop"
}
But I can still drop most nodes nearly anywhere.
How must this be done?
Or can you point me to a good example?
Help is much appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…