Fluid Infusion

The default afterMove event listener code for the Image Reorderer doesn't get invoked, causing no results to be sent back to the server.

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 0.6beta1, 0.6, 0.7, 0.8, 0.8.1, 1.0, 1.1, 1.1.1
  • Fix Version/s: 1.1.2
  • Component/s: Image Reorderer
  • Labels:
    None

Description

Currently, the Image Reorderer has a default afterMove event listener that takes care of updating the image order correctly for a form-based style of communicating with the server. It is intended to automatically POST the order back to the server after each move.

However, there is a bug in the code that causes it to never be invoked. The code tries to assign the event listener to the options.afterMoveCallback member, which is no longer supported by the Reorderer (and hasn't been since about Infusion 0.6 or so).

The fix is simple and will be included in Infusion 1.2. In the meantime, there are straightforward workarounds. Try this:

var url; // Put the URL you want to POST the order back to here.

fluid.reorderer("#gallery", {
  listeners: {
    afterMove: function (imageMoved, position, allImages) {
       images.each(function (idx, image) {
           jQuery(image).children("input").val(idx);
        });

       var imageOrder = jQuery("#reorder-form").serialize();
       jQuery.ajax({
           type: "POST",
           url: url,
           data: imageOrder,
           complete: function (data, ajaxStatus) {
               // Handle success or failure by being nice to the user.
           }
       });
    }
  }
});

Issue Links

Activity

Hide
Justin Obara added a comment - - edited
Bug Parade Infusion 1.1.2
Show
Justin Obara added a comment - - edited Bug Parade Infusion 1.1.2
Hide
Colin Clark added a comment -
This fix has been implemented and is ready for code review.
Show
Colin Clark added a comment - This fix has been implemented and is ready for code review.
Hide
Antranig Basman added a comment -
Hi - I have reviewed the changes occurring at rev. 7828 (btw, we seem to have lost commit linking on JIRA again) and they look good - I do want to query the expansion of fluid.initView that used to occur at line 117 into the 3 lines now at line 128:
        var that = {};
        fluid.mergeComponentOptions(that, "fluid.reorderImages", options);
        that.container = fluid.container(container);
which appear less idiomatic - is there a step of the initView workflow that we want to bypass here?
Show
Antranig Basman added a comment - Hi - I have reviewed the changes occurring at rev. 7828 (btw, we seem to have lost commit linking on JIRA again) and they look good - I do want to query the expansion of fluid.initView that used to occur at line 117 into the 3 lines now at line 128:         var that = {};         fluid.mergeComponentOptions(that, "fluid.reorderImages", options);         that.container = fluid.container(container); which appear less idiomatic - is there a step of the initView workflow that we want to bypass here?
Hide
Justin Obara added a comment -
It seems that the fix for this may have caused some of the image reorderer's unit tests to fail
Show
Justin Obara added a comment - It seems that the fix for this may have caused some of the image reorderer's unit tests to fail
Hide
Colin Clark added a comment -
This one is ready for code review again.
Show
Colin Clark added a comment - This one is ready for code review again.
Hide
Antranig Basman added a comment -
I have verified this as fixed, and close this JIRA through delegation of Royalty.
Show
Antranig Basman added a comment - I have verified this as fixed, and close this JIRA through delegation of Royalty.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: