Version 3.18.1
Show:

File: autocomplete/js/autocomplete-plugin.js

  1. /**
  2. Binds an AutoCompleteList instance to a Node instance.
  3. @module autocomplete
  4. @submodule autocomplete-plugin
  5. **/
  6. /**
  7. Binds an AutoCompleteList instance to a Node instance.
  8. @example
  9. Y.one('#my-input').plug(Y.Plugin.AutoComplete, {
  10. source: 'select * from search.suggest where query="{query}"'
  11. });
  12. // You can now access the AutoCompleteList instance at Y.one('#my-input').ac
  13. @class Plugin.AutoComplete
  14. @extends AutoCompleteList
  15. **/
  16. var Plugin = Y.Plugin;
  17. function ACListPlugin(config) {
  18. config.inputNode = config.host;
  19. // Render by default.
  20. if (!config.render && config.render !== false) {
  21. config.render = true;
  22. }
  23. ACListPlugin.superclass.constructor.apply(this, arguments);
  24. }
  25. Y.extend(ACListPlugin, Y.AutoCompleteList, {}, {
  26. NAME : 'autocompleteListPlugin',
  27. NS : 'ac',
  28. CSS_PREFIX: Y.ClassNameManager.getClassName('aclist')
  29. });
  30. Plugin.AutoComplete = ACListPlugin;
  31. Plugin.AutoCompleteList = ACListPlugin;