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

If singleSelect is true and listSelectedClass is not null, remove listSelectedClass from all other items in boundList #83

Closed
mikemccaughan opened this issue Sep 10, 2012 · 5 comments · Fixed by #383
Labels
Milestone

Comments

@mikemccaughan
Copy link

I'm using ImageMapster's functionality for syncing with an external list, and it works like a charm, except that even if I have singleSelect: true in the options, I still see mutiple items in my external list as "selected". I do have a simple workaround:

onClick: function (data) {
    data.listItem.siblings().removeClass(listSelectedClass); // replace listSelectedClass with actual class name
}

However, it would be nice if this were handled automatically. I expect the same thing applies to listSelectedAttribute.

@jamietre
Copy link
Owner

This does sounds like a bug. I'm about to do another release (a couple hours of freetime notwithstanding!) so will try to get this fix in.

@sb65
Copy link

sb65 commented Feb 27, 2013

I've just tripped over this same issue in similar circumstances.

With singleSelect:true, listSelectedClass and a boundList object set:

  • clicking on a map area results in the class being applied to the matching list object, and the attribute selected being set (expected)
  • subsequently clicking on a different map area does not remove listSelectedClass or the selected attribute from the matching list object (unexpected)
  • subsequently clicking on the same map area does not remove listSelectedClass or the selected attribute from the matching list object (unexpected)

Otherwise, pretty cool.

@mircian
Copy link

mircian commented Apr 18, 2013

I also confirm that the class is added but never removed :)

@MG7282
Copy link

MG7282 commented Mar 7, 2016

what's data supposed to be? I'm receiving TypeError: data.listItem is undefined

@techfg techfg removed this from the 1.2.7 milestone Jan 21, 2021
@techfg techfg added this to the 1.5.4 milestone Feb 17, 2021
@techfg
Copy link
Collaborator

techfg commented Feb 17, 2021

Hello @mikemccaughan -

Thank you for reporting this and apologies for the delayed reply!

I have confirmed this to be a bug and upon researching have identified several different issues all of which occur regardless of whether or not the user clicks on an area or the corresponding API is involved (set/select/deselect):

Describe the bug

  1. when singleSelect === true & item deselected, listSelectedClass is not removed
  2. when singleSelect === true & item deselected, listSelectedAttribute is not removed
  3. on initialization, listSelectedClass & listSelectedAttribute are not applied according to selected state of area. As an example, if an area has selected === true.
  4. when unbind & init list is not synced
  5. when rebind list is not synced
  6. when set is called with multiple keys, listSelectedClass/Attribute are not properly reflected on all keys

To Reproduce
Steps to reproduce the behavior:

  1. Go to jsFiddle
  2. Red Pepper is marked selected in area config but listSelectedAttribute & Class are not applied to bound list
  3. Click on carrots - list updates with listSelectedClass (resulting in blue background) and listSelectedAttribute (resulting in white text)
  4. Click on celery - list updates for celery but carrots is not removed
  5. Click Reset Map - carrots & celery are not removed and red pepper is not updated
  6. Click on Rebind Map - squash was added as a configured area with selected === true and it is selected but list is not updated - celery & carrots still selected. Note that singleSelect is not respected here which is a separate issue covered in singleSelect not respected when selected === true on map config and/or multiple area config #370.
  7. Uncheck all checkboxes
  8. Click Deselect All
  9. Click Toggle SingleSelect
  10. Click Toggle Carrots & Squash - Carrots & Squash both selected and list synced
  11. Click Toggle Carrots & Celery - Carrots is no longer selected but list not synced

Expected behavior
IM should sync listSelectedClass & listSelectedAttribute on every selected change that occurs either via user action or API call.

techfg added a commit that referenced this issue Feb 21, 2021
techfg added a commit that referenced this issue Feb 21, 2021
Resolves #83 
Resolves #377
Resolves #378
Resolves #380
Resolves #381
@techfg techfg changed the title Feature: If singleSelect is true and listSelectedClass is not null, remove listSelectedClass from all other items in boundList If singleSelect is true and listSelectedClass is not null, remove listSelectedClass from all other items in boundList Feb 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants