Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

How to Filter Markers? #551

Open
malinga91 opened this issue May 5, 2017 · 0 comments
Open

How to Filter Markers? #551

malinga91 opened this issue May 5, 2017 · 0 comments

Comments

@malinga91
Copy link

malinga91 commented May 5, 2017

I have 5 buttons. One button for 1 category. I need to filter markers when click on buttons. I did in this way

` $(document).on('change', '.num', function(e) {
var $num = $(this).val();

    if ($num != undefined) {

        var filtered = map.markerFilter(function() {
            return this == $num;
        });

        var non_filtered = map.markerFilter(function() {
            return this != $num;
        });

        console.log(filtered.length);

        for (var index = 0; index < filtered.length; index++) {
            filtered[index].setVisible(true);
        }
        for (var index = 0; index < non_filtered.length; index++) {
            non_filtered[index].setVisible(false);
        }

        console.log('fli '+filtered.length);
        console.log('non fil '+non_filtered.length);
    }
});`

But, this works only one time. Assume I clicked on Button 1 then click on Button 2. Then I'm not getting markers related to Category 1 (Btn 1)

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

No branches or pull requests

1 participant