Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Drag from sub menu

    I have an isc.Menu that is connected to a client side isc.DataSource that has sub menus via each datasource entry having a parentID that associates sub menu items with one of the main menu items.

    The DataSource looks like this:
    Code:
    isc.DataSource.create({
      ID: "mainMenuDS",
      clientOnly: true,
      dataFormat: "json",
      sortField: "order",
      fields: {
        name: {
          title: "Menu Item",
          primaryKey: true,
          name: "name",
          required: true,
          type: "text",
          length: 128
        },
        parentID: {
          hidden: true,
          name: "parentID",
          required: true,
          type: "text",
          rootValue: "root",
          foreignKey: "mainMenuDS.name"
        },
        title: {
          title: "Title",
          name: "title"
        }
      }
    });
    And the menu itself looks like this:
    Code:
    isc.Menu.create({
      dataSource: mainMenuDS,
      loadDataOnDemand: false,
      canSelectParentItems: false,
      selectionType: "single",
      canDragRecordsOut: true,
      dragDataAction: 'copy',
      canAcceptDrop: false,
      dragType: "myDragItem",
      setDragTracker: function() {
        return true;
      },
      dragStart: function() {
        var record, tracker;
        record = this.getSelectedRecord();
        tracker = "";
        tracker += "<div style='text-align:center;'><img src=\"" + record.icon + "\" /><br />";
        tracker += record.title;
        tracker += "</div>";
        return isc.EventHandler.setDragTracker(tracker);
      }
    });
    The menu itself is working great, and I can drag items out of the main level. The problem is that I can't drag anything out of the sub menus. Using Firebug I have determined that dragStart is never called when attempting to drag a sub item.

    I assume that the sub menu is being auto generated from a default isc.Menu class that doesn't have my dragStart code defined in it.

    So the questions are: What am I missing? Why can't I drag out sub items? Is it possible to specify the class for the sub menu so that it can pickup my added code?

    Any help would be appreciated.

    Thanks,
    Chris

    #2
    You can do this via setting menu.submenuConstructor to the name of a subclass of Menu. This wasn't adequately documented - we're adding more docs now.

    Comment


      #3
      That worked perfectly!

      Thanks!

      -Chris

      Comment

      Working...
      X