jquery-ui-multiselect-widget icon indicating copy to clipboard operation
jquery-ui-multiselect-widget copied to clipboard

Widget fails to update original select element

Open ghost opened this issue 6 years ago • 4 comments

What is the current behavior?

The original select element is not updated with the user's checking and unchecking

What is the expected behavior?

I click a checkbox in the multiselect and the original select is updated. If I click the checkbox Main then the original select option Main is updated as selected.

ghost avatar Mar 14 '19 01:03 ghost

What version of the widget are you using?

mlh758 avatar Mar 14 '19 17:03 mlh758

version 2.0.1

but I modified it and added these 2 functions

resync : function() { var $inputs = this.$inputs; var $options = this.element.find('option'); if ($inputs.length === $options.length) { var inputValues = {}; $inputs.each( function() { inputValues[this.value] = this;
}); $options.each( function() { if (this.value in inputValues) { inputValues[this.value].checked = this.selected; } }); this._trigger('resync'); this.update(); } else { this.refresh(); } }, val: function(newValue) { if (typeof newValue !== 'undefined') { this.element.val(newValue); this.resync(); return this.element; } return this.element.val(); },

And I added this line in the _makeOption

  // Icon images for each item.
  var optionImageSrc = option.getAttribute('data-image-src');
  if (optionImageSrc) {
    var img = document.createElement('img');
    img.setAttribute('src', optionImageSrc);
    span.insertBefore(img, span.firstChild);
  }

ghost avatar Mar 14 '19 17:03 ghost

It seems like v3 already has this fix?

mlh758 avatar Jun 04 '19 21:06 mlh758

I'm using Version 2. I can't use Version 3 it doesn't work with the program and breaks the whole program.

On Tue, Jun 4, 2019 at 5:41 PM Michael [email protected] wrote:

It seems like v3 already has this fix?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ehynds/jquery-ui-multiselect-widget/issues/840?email_source=notifications&email_token=AD37CF3KMOA3NCGXD3JVGW3PY3OPJA5CNFSM4G6KAH42YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODW56SWA#issuecomment-498854232, or mute the thread https://github.com/notifications/unsubscribe-auth/AD37CF27SKL6KYQT3LQYXKLPY3OPJANCNFSM4G6KAH4Q .

ghost avatar Jul 08 '19 16:07 ghost