yanickrochon/jquery.uix.multiselect

Re-ordering does not send multiselectChange

fnxweb opened this issue · 1 comments

I am using the widget with “sortable” enabled to update a link elsewhere as changes are made to the selection (it's not being used an a form that will be submitted).

While I am getting the multiselectChange event for additions and removals OK, I don't get it when the list is re-ordered (and the order is important to me).

While it could probably be factored more cleanly, & it might have unforeseen [by me] side-effects, I got what I wanted by editing _createGroupContainerElement (~ line 827):

 /* FNX - send update when items dragged */
 /* if (e) that._reorderSelected(e.optionGroup); */
 if (e) {
   that._reorderSelected(e.optionGroup);
   if (!_received_index)  /* already done if _received_index */
     that._widget._triggerUIEvent(EVENT_CHANGE, { optionElements:[e.optionElement[0]], selected:true } );
 }
 /* /FNX */

I was about to post a similar issue but I'll just pop into this one instead. I was going to suggest a separate event for reorder. In my implementation, I tapped into the jQueryUI events for sortable so I could run a different function on reorder than on change.