JavaScript jsTree custom contextmenu not filtering based on type folder/file jstree custom context menu example,jstree custom contextmenu,jstree context

I am trying to configure a custom context menu for jsTree. I want files to have two options [Rename, Delete] and I want folders to have one option [Create]

The below code seems correct as described here: Configuring jstree right-click contextmenu for different node types

However this does not seem to work, there are two problems.

  1. Both context menus display the options [Rename, Delete]
  2. Choosing either option causes the error: Uncaught TypeError: undefined is not a function

enter image description here

What am I doing wrong? Edit: here is a fiddle

$( document ).ready(function() {
    function customMenu(node) {
        // The default set of all items
        var items = {
            createItem: { // The "create" menu item
                label: "Create",
                action: function () {
                    this.create(node);
                }
            },
            renameItem: { // The "rename" menu item
                label: "Rename",
                action: function () {
                    this.rename(node);
                }
            },
            deleteItem: { // The "delete" menu item
                label: "Delete",
                action: function () {
                    this.remove(node);
                }
            }
        };

        if ($(node).hasClass("folder") || $(node).hasClass("jstree-closed") || $(node).hasClass("jstree-open")) {
            delete items.deleteItem;
            delete items.renameItem;
        }

        else{
            delete items.createItem;
        }

        return items;
    }

    $('#tree').jstree({
        'core': {
            'data': [
                { "id": "ajson1", "parent": "#", "text": "Folder 1" },
                { "id": "ajson2", "parent": "ajson1", "text": "File 1" },
                { "id": "ajson3", "parent": "ajson1", "text": "File 2" }
            ]
        },
        "plugins": [ "contextmenu" ],
        "contextmenu": {items: customMenu}
    });
});
Answer:1

I'm trying to see if I can do the following: Have some Javascript make a call to JavaFX. Have JavaFX then spawn a thread to do work it has been given from the Javascript. Come back to the Javascript ...

I'm trying to see if I can do the following: Have some Javascript make a call to JavaFX. Have JavaFX then spawn a thread to do work it has been given from the Javascript. Come back to the Javascript ...

I'm just curious that how can a .mov file play in a browser without any plug in support.I know that .mp4,.ogg and .webm filescan play without any plug in because the html5 video tag support them.but ...

I'm just curious that how can a .mov file play in a browser without any plug in support.I know that .mp4,.ogg and .webm filescan play without any plug in because the html5 video tag support them.but ...

  1. google play file browser
  2. play midi file browser
  3. play wav file browser
  4. play mp4 file browser
  5. play file on browser
  6. play gsm file browser
  7. play wmv file browser
  8. play ts file in browser
  9. play m3u8 file in browser
  10. play mkv file in browser
  11. play audio file in browser
  12. play mov file in browser
  13. play swf file in browser
  14. play avi file in browser
  15. play video file in browser
  16. play mp3 file in browser
  17. play pls file in browser
  18. play flv file in browser

I have this function: $(".insidediv").hide(); $(".floater").mouseenter(function(){ $(".hideimg").fadeOut(function(){ $(".insidediv").fadeIn(); }); }); $(".floater").mouseleave(...

I have this function: $(".insidediv").hide(); $(".floater").mouseenter(function(){ $(".hideimg").fadeOut(function(){ $(".insidediv").fadeIn(); }); }); $(".floater").mouseleave(...

  1. some issues with
  2. some issues with health
  3. some issues with family
  4. some problems with
  5. some problems with technology
  6. some problems with regulatory agencies
  7. have some issues with
  8. some issues with the current
  9. what are some issues with outsourcing jobs
  10. what are some issues with cloning
  11. there are some issues with
  12. we have some issues with
  13. i had some issues with
  14. some general issues associated with testing

Is there a way to receive the data from pay-pal that comes out when someone has confirmed they have bought my item and the payment has gone through? I am looking to then use this data to remove an ...

Is there a way to receive the data from pay-pal that comes out when someone has confirmed they have bought my item and the payment has gone through? I am looking to then use this data to remove an ...

  1. receive data from bluetooth android code