This space is an archive space for documentation related to old versions of Fluid Infusion (i.e. versions before 1.3). For documentation related to the latest Infusion, see Infusion Documentation.
Tutorial - Layout Customizer 0.5 Migration
The Layout Customizer has been renamed the Layout Reorderer, and its API has been simplified. This page will walk you through the process of upgrading your existing 0.4 Layout Customizer implementation to the new 0.5 Layout Reorderer API. This tutorial assumes that
- you are already familiar with HTML, Javascript and CSS
- you are familiar with what the Layout Customizer/Reorderer is and does
- you have an existing implementation of the Layout Customizer that worked with the 0.4 Infusion release.
Dependencies
If you use the Fluid-all.js
file, you don't have to change this - this file still contains everything you need.
If, however, you are including independent files, you will need to add three files to your list: FluidDOMUtilities.js
, GeometricManager.js
and ModuleLayout.js
. LayoutCustomizer.js
has been renamed to LayoutReorderer.js
. You also no longer need ui.droppable.js
.
If you have... |
You will need... |
---|---|
jquery/jquery-1.2.6.js jquery/jquery.keyboard-a11y.js jquery/ui.core.js jquery/ui.draggable.js jquery/ui.droppable.js jquery/jARIA.js fluid/Fluid.js fluid/Reorderer.js fluid/LayoutCustomizer.js |
jquery/jquery-1.2.6.js jquery/jquery.keyboard-a11y.js jquery/ui.core.js jquery/ui.draggable.js jquery/jARIA.js fluid/Fluid.js fluid/FluidDOMUtilities.js <== new! fluid/GeometricManager.js <== new! fluid/Reorderer.js fluid/ModuleLayout.js <== new! fluid/LayoutReorderer.js <== formerly LayoutCustomizer.js |
Join the fluid-talk mailing list and ask your questions there.
Initialization
The initialization of the Layout Reorderer now uses the function fluid.reorderLayout()
.
If you used to have... |
Now you would have... |
---|---|
fluid.initLayoutCustomizer(containerSelector, layoutSelectors, orderChangedCallback, options); |
fluid.reorderLayout(container, options); |
The specific changes are as follows:
- the
container
parameter can now be- a CSS-based selector
- a single-element jQuery object, or
- a DOM element
- the
itemSelector
andorderChangeCallback
are now specified through theoptions
paramter
Layout Selectors
Instead of passing selectors identifying the columns and modules as parameters to reorderLayout()
, the selectors are specified using the selectors
option.
If you used to have... |
Now you would have... |
---|---|
var layout = { columns: "td", modules: "td > div" }; fluid.initLayoutCustomiser("#modules-root", layout); |
var opts = { selectors: { columns: "td", modules: "td > div" } }; fluid.reorderLayout("#modules-root", opts); |
Order-changed Callback
Instead of passing an order-changed callback function as a parameter to reorderLayout()
, the callback is specified using the events
option, in particular the afterMove
event.
If you used to have... |
Now you would have... |
---|---|
var myCallback = function() { ... }; fluid.initLayoutCustomizer(myElem, layout, myCallback); |
var myCallback = function() { ... }; var options = { selectors: { columns: "td", modules: "td > div" }, events: { afterMove: myCallback } }; fluid.reorderLayout(myElem, options); |
Options
Changes have been made to the format of the options
object:
cssClassNames
The cssClassNames
option has been renamed to styles
:
If you used to have... |
Now you would have... |
---|---|
var myClasses = { defaultStyle: "plain", selected: "selected", dragging: "dragging }; var opts = { cssClassName: myClasses }; fluid.initLayoutCustomizer(myLayoutSel, myPerms, myCallback, opts); |
var myClasses = { defaultStyle: "plain", selected: "selected", dragging: "dragging }; var opts = { styles: myClasses }; fluid.reorderLayout(myLayoutSel, opts); |