By CobaltSkyPlease note: you must be signed in to download this file:
This demo file is for FileMaker versions 13 and higher. While we've used variations of some of the techniques shown in this demo over many years, and some have appeared in different forms in previous demos, the advances in the feature set of FileMaker 13 & above provide an opportunity to refine, combine and simplify the techniques to provide an enhanced user experience.
Not infrequently, users need to apply manual or custom sorting to small groups of data items - such as priority lists, agenda items, queue management, task lists, seating plans and the like. Many widely used applications support dragging items in a list to provide for requirements of this type, which in turn establishes user expectations. However in FileMaker Pro, portals don't normally work that way. For most situations that's fine and you wouldn't want them to (ie the sort order is determined logically by another method). For those occasions when a manual sorting interface (ie dragging rows into a different position) *is* appropriate, here's a way to achieve it.
The method shown here allows the user to drag a row and drop it on the upper half of any visible row to reposition the dragged row above the destination row, or to drop the row on the lower half of any visible row to reposition the dragged row below the destination row. To achieve this, three fields are required - one to provide a token for the user to drag and drop and to receive the dropped token, a second field to map where the token is dropped and a third field to provide a sort index for the established row order. The rest is managed using triggered scripts which make economical use of the Get(CurrentTimeUTCMilliseconds) function, together with the List( ) and Evaluate( ) functions to identify clicks and sequencing, determine the appropriate action and then update the portal in response to the user's input.
When introducing functionality of this type, it is important to avoid compromises that will emerge if other operations the user needs to perform are impeded. For example, users may need to select or edit a portal row, whilst also needing to be able to control the sort order. With the technique shown here, three kinds of mouse action are supported simultaneously. A single click will select a portal row (using native row selection and highlighting, not a stored ID), a double-click will expose an edit pane (using a FileMaker popover) to view, enter or edit detail for the row in question - and a drag action will modify the sort order of visible rows.
It should be noted that while single- and double-click actions based on the principles shown in this demo work similarly throughout the FileMaker platform, drag-and-drop functionality is not supported on v13 - above implementations of FileMaker Go or WebDirect, so different methods of manual sorting will be required for solutions that will be accessed in those environments. However for interfaces that will be accessed in FileMaker Pro or FileMaker Pro Advanced, the full demo functionality is operable.
*This demo is provided free for private and educational purposes, and may be licensed for commercial and business applications. Should you require assistance implementing procedures such as those shown in our example files, please consider establishing an account for developer support...to do so here just PM me or visit my website.