开发者

How to manage the contextmenu of jsTree as per the file and folder

开发者 https://www.devze.com 2023-02-03 04:45 出处:网络
I have stuck to manage the contextmenu after the right click . Actually I need to display some item of contextmenu for folder and some item of contextmenu for folder.

I have stuck to manage the contextmenu after the right click . Actually I need to display some item of contextmenu for folder and some item of contextmenu for folder.

On click of folder context menu will look like :

On click of file context menu will look like :

  • create
  • remove
  • rename

Is there any way to manage this menu after click . I have look into documentation and other blog , but not getting useful content .

Can you please guide me some thing so that I can implement like that .

Thanks in advance


Hello ,

Thanks for take a look, but I got the way to make it Please take a look on below :

$('#detail_dir_container').jstree({
      "json_data" : {
        "ajax" : { 
          "url" : ''
        }
      },
      "contextmenu" : {
              "items": function(node){
                    if(node.attr('type') == 'file' )
                    {
                      return {
                        create : true,
                        rename : true,
                        remove : true
                     }
                  }
                  else
                  {
                    return {
                      create : true,
                      rename : true,
                      remove : true,
                      new    : true,
                    }
                  }
        }
    });



Thanks
0

精彩评论

暂无评论...
验证码 换一张
取 消