What are Drag Types and Drop Targets?
Drag and drop actions allow users to click and drag an item from location to another within a screen. This allows users to intuitively interact with content, rearrange items, and trigger further actions by dropping onto a designated area. Some examples of drag and drop actions are:
- Dragging a record from a grid onto a delete area to remove it
- Dragging a contact from a grid onto a specific company on a company table to move that contact to that company
- Dragging items into different sections on a Kanban board to change the state of the record - see Making Kanban Boards
How are Drag Types and Drop Targets Configured?
To set up drag and drop on components, a on the object you are dragging from and a Drag Type on the object you are dropping onto is required. Components that can have Drop Target are: Drag Type
- grids
- cards
Any component which has an can be a Drop Target. The Drop Action (performed when the drop occurs) is configured in an Actionflow on the Drop Target. Actions tab
For example, to assign a new company to an employee, a user creates two grids on a screen. The employee and company table have a relationship and are linked by a CompanyIDfield. The employee can be dragged and dropped onto a company to update CompanyID attribute for the employee.
Creating Drag and Drop Actions
s and Drag Type s are set on components on a screen. Drop Target
Creating a Drag Type
- Right-click on the grid and select on the component Show the View Configurationfrom which data will be dragged
On the , i Actions tabn the Action Settings section, under Drag Type, select or create a drag type, e.g.
Move Contact
- If creating a Drag Type, click the
- Name: Enter a name for the drag type
- Attributes: create the attributes to be used in the Actionflow, e.g. CompanyID
- Apply and Close
button - A Drag Mappings section will become available in the Action Settings
- Click the button Configure Mappings
- Map across attributes from the table onto the attributes set above, to be used within the Actionflow Drag Type
Components with a drag type can be dragged and dropped onto any component which has a drop target with a matching drag type.
Creating a Drop Target
- Click on the component where data will be dropped to open the Properties
- On the , i Actions tabn the Drop Targets section, select or create a drop target, e.g.
Add Contact
- If creating a Drop Target, click the
- Name: Enter a name for the drop target
- Drag Type: Select the drag type (e.g. Move Contact) that matches the drag type set on the component being dragged
- Drop Action: Select Actionflow
- Actionflow: Select or create an Actionflow to run when a component with a matching drag type is dropped onto this component
- Apply and Close
button - If creating an , select the Actionflow as the an Drag Type input
- Map in the attribute(s) created on the Drag Type
- Then configure your Actionflow as required, e.g. delete a record, move that contact to a company, change the state of the record, etc.
Worked Examples
Here's a worked example using the Company Data (available from the Learning Centre).
In this example, we are using:
- A Company Approval Review screen containing:
- a grid backed by the Companies table
- with a Background Filter to only companies where their Status does not equal Approved or Rejected
- two areas containing Approve and Reject icons - this screen was created using the Multi-Tile template
- a grid backed by the Companies table
If you are completing this chapter as part of the Actionflow course and using a training instance, the data and screens have already been pre-loaded into the Actionflow Advanced Application. For this example, we'll be working on the Company Approval Review screen.
Example 1: Approve Company Using Drag and Drop
In this example, we'll configure company records on a grid to be draggable, and set up an area on a screen as a drop target to receive the record(s). When a company is dropped in the area, its Status will be updated to Approved. We'll add some additional processing to our Actionflow to update the audit details on the record, showing who made the change, along with the date and time.
Drag Type Setup
- Open the Company Approval Review screen by clicking on the Approvals button in the top menu
- Right-click on the Companies Pending Review grid and select Show the View Configuration
- Click the Actions tab
- In the Action Settings section, click the to create a new drag type: Drag Type
- Name:
Company
- Click Apply
- Attributes: select
- Name:
CompanyID
- Type:
Integer
- Name:
- the Drag Type tab Apply and Close
icon next to - Name:
- A Drag Mappings section will become available in the Action Settings on the View
- Click the button Configure Mappings
- Map across the CompanyID attribute from the Companies to the View Drag Type
- Click Confirm Mappings
- the View Apply and Close
Drop Target Setup
- On the Company Approval Review screen
- Click on the area holding the icon
- Ensure the for the area, OuterBorderTop, is selected Properties
- Click the Actions tab
- In the Drop Targets section, click the
- Name:
CompanyApproval
- Drag Type: Select the Company Drag Type you set up above
- Drop Action:
Actionflow
- Actionflow: click
- Name:
Company Approval
to create a new Actionflow - Name:
icon to add a new drop target: - Name:
Actionflow Setup
- Connect the input of the Company Drag Type
- Map in the CompanyID attribute
- Create a action Calculate
- Name:
Update Status and Audit
- Name:
- Add three Output Attributes:
- NewApprovedStatus: this should contain a string with the new status
- NewUpdatedByName: this should contain details of the user making the change using the internal variable _user - see Internal Variables
- Review the Companies table data to see the formatting of this attribute
NewUpdatedByTime: this should contain the date and time the user updates the record
- Connect the action Calculate input to the
- Hover over the Calculate action and click, out
- Click anywhere on the canvas to create a new
- Name:
Save Company
- Type:
Update
- Table:
Companies
Save action - Name:
- Map across the three attributes created by the Calculate action onto their relevant attributes in the Companies table, and the CompanyID from the input
Testing
- Close and reopen the Company Approval Review screen, the screen Lock
- Drag a company from the Companies Pending Review grid onto the Approve icon
- The company should be removed from this screen and instead appear on the Companies screen
Example 2: Reject Company Using Drag and Drop (Optional)
Repeat the steps above to set up the area holding the
icon as a Drop Target. Remember to change the Expression in the Output Attribute to "Rejected".