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

Possible bug in jquery-ui-map 3.0 rc "find" method. #66

Open
GoogleCodeExporter opened this issue Nov 27, 2015 · 0 comments
Open

Possible bug in jquery-ui-map 3.0 rc "find" method. #66

GoogleCodeExporter opened this issue Nov 27, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

Method "find" didn't work properly for me when I tried to write my own
code based on "Google maps jQuery plugin 3.0-rc1 filter
by property" example. Here is my attempt to fix the problem:

find: function(ctx, options, callback) {
        var obj = this.get(ctx);

        options.value = $.isArray(options.value) ? options.value : [options.value];
        for ( var property in obj ) {
                // Correct search in marker properties. We are looking for options.property.
                if ( obj[property].hasOwnProperty(options.property) ) {
                        // We always need an array for inArray method.
                        obj[property][options.property] = $.isArray(obj[property][options.property]) ? obj[property][options.property] : [obj[property][options.property]];

                        var isFound = false;
                        for ( var value in options.value ) {
                                // the second argument must be an array.
                                if ( $.inArray(options.value[value], obj[property][options.property]) > -1 ) {
                                        isFound = true;
                                } else {
                                        if ( options.operator && options.operator === 'AND' ) {
                                                isFound = false;
                                                break;
                                        }
                                }
                        }
                        callback(obj[property], isFound);
                }
        }
        return this; 


Original issue reported on code.google.com by [email protected] on 25 Nov 2012 at 5:43

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

No branches or pull requests

1 participant