Properties Methods Events Direct Link

# Class Ext.ux.ToolbarDroppable

Package: | Ext.ux
Defined In: | ToolbarDroppable.js
Class: | ToolbarDroppable
Extends: | Object

Plugin which allows items to be dropped onto a toolbar and be turned into new Toolbar items. To use the plugin, you just need to provide a createItem implementation that takes the drop data as an argument and returns an object that can be placed onto the toolbar. Example:

    new Ext.ux.ToolbarDroppable({
    createItem: function(data) {
    return new Ext.Button({text: data.text});
    }
    });

The afterLayout function can also be overridden, and is called after a new item has been created and inserted into the Toolbar. Use this for any logic that needs to be run after the item has been created.

## Public Properties

Property | Defined By
--- | ---
| afterLayout : Object Called after a new button has been created and added to the toolbar. Add any required cleanup logic here | ToolbarDroppable
| dropTarget : Ext.dd.DropTarget The drop target attached to the toolbar instance | ToolbarDroppable
| toolbar : Ext.Toolbar The toolbar instance that this plugin is tied to | ToolbarDroppable

## Public Methods

Method | Defined By
--- | ---
| addDDGroup( `String ddGroup` ) : void Adds the given DD Group to the drop target Adds the given DD Group to the drop target Parameters: `ddGroup` : String The DD Group Returns: void | ToolbarDroppable
| calculateEntryIndex( `Ext.EventObject e` ) : Number Calculates the location on the toolbar to create the new sorter button based on the XY of the drag event Calculates the location on the toolbar to create the new sorter button based on the XY of the drag event Parameters: `e` : Ext.EventObject The event object Returns: `Number` The index at which to insert the new button | ToolbarDroppable
| canDrop( `Object data` ) : Boolean Returns true if the drop is allowed on the drop target. This function can be overridden and defaults to simply return... Returns true if the drop is allowed on the drop target. This function can be overridden and defaults to simply return true Parameters: `data` : Object Arbitrary data from the drag source Returns: `Boolean` True if the drop is allowed | ToolbarDroppable
| constructor() : void Parameters: None. Returns: void | ToolbarDroppable
| createDropTarget() : void Creates a drop target on the toolbar Creates a drop target on the toolbar Parameters: None. Returns: void | ToolbarDroppable
| createItem( `Object data` ) : Mixed Creates the new toolbar item based on drop data. This method must be implemented by the plugin instance Creates the new toolbar item based on drop data. This method must be implemented by the plugin instance Parameters: `data` : Object Arbitrary data from the drop Returns: `Mixed` An item that can be added to a toolbar | ToolbarDroppable
| init( `Ext.Toolbar toolbar` ) : void Initializes the plugin and saves a reference to the toolbar Initializes the plugin and saves a reference to the toolbar Parameters: `toolbar` : Ext.Toolbar The toolbar instance Returns: void | ToolbarDroppable
| notifyDrop() : void Called when the drop has been made. Creates the new toolbar item, places it at the correct location and calls the aft... Called when the drop has been made. Creates the new toolbar item, places it at the correct location and calls the afterLayout callback. Parameters: None. Returns: void | ToolbarDroppable
| notifyOver() : String Custom notifyOver method which will be used in the plugin's internal DropTarget Custom notifyOver method which will be used in the plugin's internal DropTarget Parameters: None. Returns: `String` The CSS class to add | ToolbarDroppable

## Public Events

This class has no public events.