Skip to content

Update event: setLegendElemsState accepts object #114

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

Merged

Conversation

Indigo744
Copy link
Collaborator

Before, it was only possible to show/hide all legends at once.
But there can be multiple legends on a map (example: http://jsfiddle.net/neveldo/VqwUZ/ or http://jsfiddle.net/neveldo/xd2azoxL). Maybe the user want to show/hide all elements of one of these legends?
Hence the setLegendElemsState is extended to allow the following:

setLegendElemsState = "show"    // will show all legend element (current behavior)
// OR
setLegendElemsState = {
    "areaLegend": "show",        // will show all element in areaLegend
    "plotLegend": "hide",        // will hide all element in plotLegend
    "myLegendClassName": "hide", // will hide all element in myLegendClassName
    ...
},

The user pass the CSS class name of the legend it want to show/hide.

Implements #110 First point.

@Indigo744 Indigo744 changed the title Indigo744 patch set legend elems state object Update event: setLegendElemsState accepts object Nov 16, 2015
});
if (typeof opt != "undefined" && typeof opt.setLegendElemsState === "object") {
// setLegendElemsState is an object listing the legend we want to hide/show
var $container = $(this); // save this before each for use in callback
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could use the already defined variable $self instead of $container here

@Indigo744
Copy link
Collaborator Author

Right! This would be better :-)

What do you think now?

@neveldo
Copy link
Owner

neveldo commented Nov 17, 2015

It's ok for me :)

However, I think that you should provide a new example in the 'advanced' directory for the demo because the 'basic' directory should stand for basic examples that only involve configuration without extra JS code.

@Indigo744
Copy link
Collaborator Author

Right :-) done!

@neveldo
Copy link
Owner

neveldo commented Nov 18, 2015

Thank you, I merge your PR !

neveldo added a commit that referenced this pull request Nov 18, 2015
…State-object

Update event: setLegendElemsState accepts object
@neveldo neveldo merged commit 4bd1c62 into neveldo:master Nov 18, 2015
@Indigo744 Indigo744 deleted the Indigo744-patch-setLegendElemsState-object branch November 18, 2015 12:52
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

Successfully merging this pull request may close these issues.

2 participants