、add_before、およびadd_afterをjstreeに含める方法はありますか
例えば:
.bind("add_after.jstree", function (node,data){
#perform some function
})
、add_before、およびadd_afterをjstreeに含める方法はありますか
例えば:
.bind("add_after.jstree", function (node,data){
#perform some function
})
jsTree はイベントを使用して、ツリーで発生した変更を通知します。すべてのイベントは、jstree 名前空間のツリー コンテナーで発生し、それらをトリガーした関数にちなんで名付けられます。
と
また、特別なイベントが 1 つあります。それは before.jstree です。このイベントにより、操作の実行を防ぐことができます。
したがって、次のように新しいノードが挿入される前後のイベントをリッスンできるはずです。
$(function () {
$("#treeId").bind("before.jstree", function (e, data) {
if(data.func === "create_node") {
// This block will execute before inserting a new node
}
});
$("#treeId").bind("create_node.jstree", function (e, data) {
// This block will execute after inserting a new node
});
});