Uploaded image for project: 'Fluid Infusion'
  1. Fluid Infusion
  2. FLUID-3121

Reorderers confuse handling of 'container' as selector/element



    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.1.1
    • 1.1.2
    • Layout Reorderer
    • None


      The Layout Reorderer API specification says about fluid.reorderLayout = function(container, userOptions) that "The container is a CSS-based selector, single-element jQuery object, or DOM element that identifies the DOM element containing the layout.", and all the documentation and sample code I can find supplies a selector string as the first argument to that function.

      Yet if I call fluid.reorderLayout = function(container, userOptions) to create my reorderer, supplying the first argument as a selector string, when the reorder later tries to create the model to serialize and post to my afterMoveCallbackUrl, it will explode inside fluid.getId = function (element) because fluid.moduleLayout.layoutToIds = function(idLayout) used to create the model calls fluid.getId(idLayout.container) when the idLayout.container var has been initialized to the given selector string, and not an element as required by getId.

      I modified my code to supply the element result from fluid.container = function (containerSpec) to the fluid.reorderLayout function, and now everything appears works as designed for me, with the model being serialized correctly and posted when any modules are reordered.

      Looking into the problem deeper, the specification for fluid.reorderer = function (container, options) says '@param container - the root node of the Reorderer', implying that argument should be an element, yet fluid.reorderLayout = function (container, userOptions) says '@param


      a selector for the layout container' and yet forwards that 'container' selector param to the reorderLayout function untouched.

      I looked into fluid.reorderImages = function (container, options) for comparison, and it starts off looking smarter to me, calling 'var that = fluid.initView = function (componentName, container, userOptions)' and then using the result to create 'var containerEl = fluid.unwrap(that.container)', which it then supplies to several functions. But then it later appears to go off and supply the original 'container' spec to fluid.reorderer and several other functions which look like they also expect an element?

      My newb reaction would be to patch fluid.reorderImages to supply 'containerEl' to all functions expecting an element, and fluid.reorderLayout should be patched to have similar operation, calling fluid.initView, etc.

      But I really have to wonder, am I totally confused and missing something here?




            colin Colin Clark
            hubick Chris Hubick
            0 Vote for this issue
            1 Start watching this issue