GithubHelp home page GithubHelp logo

kyleneedham / autocomplete Goto Github PK

View Code? Open in Web Editor NEW
13.0 2.0 7.0 191 KB

Marionette AutoComplete Behavior -

Home Page: http://kyleneedham.github.io/autocomplete/

License: MIT License

CoffeeScript 100.00%

autocomplete's People

Contributors

bweston92 avatar kyleneedham avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

autocomplete's Issues

implicit dependency to bootstrap

hi! thank you for this project!

I just open an issue as I had troubles at first using it as the dependency to Bootstrap is only specified in a52bb74 commit message, probably explaining the errors I get with

@ui.autocomplete.dropdown 'toggle'

and the events

'shown.bs.dropdown': 'setDropdownShown'
'hidden.bs.dropdown': 'setDropdownHidden'

which I guess aren't fired.

I don't know if you are still maintaining this project, but I thought it might a useful information for other people arriving here

How to set dinamically the data

Hello!

Good piece of software. Congratulations!

I need to set a behavior dynamically inside a view, much like this:

javascript
return Marionette.LayoutView.extend({
initialize: function(options){
this.autoCompleteData = options.autoCompleteData || [];
// this.behaviors.AutoComplete.collection.data = options.autoCompleteData;
// this.behaviors.AutoComplete.behaviorClass.setDataset(options.autoCompleteData);
},
template: SimpleSearchTemplate,
events: {
"click #search-button": "search"
},
ui: {
autocomplete: "#search-box"
},
behaviors: {
AutoComplete: {
behaviorClass: AutoComplete.Behavior,
collection: {
options: {
type: 'dataset',
data: this.autoCompleteData
}
}
}
},
search: function(){

        var value = $("#search-box").val();

        if (value !== null && value !== undefined) {
            vent.trigger("search:poi:byNameAddressBuilding", value);
        }
        else {
            this.clear();
        }
    }
});

I know this will not work, so I've been trying to get using the `setDataset`function. How can I do that? I've been looking for it, without success.

Custom template doesn't seem to work

I'm trying to use a handlebars template as I would on a normal view but it doesn't seem to do anything I just get the default result list.

Views.Form = Marionette.ItemView.extend({
        template: formTpl,
        className: "wrapper",
        ui: {
          autocomplete: '#product'
        },
        behaviors: {
          AutoComplete: {
            behaviorClass: AutoComplete.Behavior,
            collection: {
              options: {
                type: 'remote',
                remote: '/api/product/search',
                valueKey: 'sku',
                keys: {
                  query: 'q',
                  limit: 'page_limit'
                },
                values: {
                  limit: 3
                }
              }
            },
            childView: {
              definition: AutoComplete.ChildView.extend({
                template: searchTpl
              })
            }
          }
        }
      });

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.