Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.remove() method used for option thows a null reference exception #72

Open
thirumalaicb opened this issue Jul 4, 2013 · 0 comments
Open

Comments

@thirumalaicb
Copy link

Hi,

I am using your multiselect control. I find an issue when I do the below steps. This issue is there in the demo page as well.

http://mind2soft.com/labs/jquery/multiselect/optionvalues.html

Steps to repro:

  1. Let all the items be in the available side.
  2. Click on any item and it gets selected and displayed in the selected side.
  3. Programmatically remove the item using .remove().
  4. Click on any item on the available side, and it does not get added to the selected side.
  5. You get the below client-side error.

multiselect_error

I have fixed it using the below code (line # 1084).

var element = this._elements[optElement.data('element-index')];
if (element != null || element !== undefined)
this._elements[optElement.data('element-index')]
.listElement(optElement.prop('disabled') ? "add" : "remove") + "Class";

In order to get the option deselected, I have used the below line of code (not sure of any method available within multiselect to deselect it).

$('#id option[value="0"]').removeAttr('selected');
$('#id).multiselect('refresh');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant