Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #4705 (new enhancement)

Opened 2 years ago

Last modified 2 years ago

Callback for onObserverEvent in Autocompleter

Reported by: bjoern.wolf@e-tecture.com Assigned to: thomas@fesch.at
Priority: normal Milestone:
Component: script.aculo.us Version:
Severity: normal Keywords:
Cc:

Description

We needed this one for a project where Autocompleter should only request if some given input fields consists of special values. The only workaround was to change the "minChars" to an higher value so that the "onObserverEvent" wont be fired.

Change History

04/12/06 07:25:23 changed by bjoern.wolf@e-tecture.com

The more elegant version was to implement (patch) this behaviour by extending the Autocompleter.Base with a new Callback-Option:

The baseInitializer:

this.options.onObserving = this.options.onObserving || 
function() { return true };

The event itself:

onObserverEvent: function() {
    this.changed = false;   
    if(this.getToken().length>=this.options.minChars && this.options.onObserving()) {
      this.startIndicator();
      this.getUpdatedChoices();
    } else {
      this.active = false;
      this.hide();
    }
  },