@@ -801,13 +804,19 @@ AutocompleteBehavior = Behavior.create({ var typedId = target[0] var completer = target[1]+ var options = {paramName:'query', method:'get', parameters: parameters}; + var select = this.element.className.match(/autocomplete- select::([\S]+)/) + if (select) options.select = select[1] + + var afterUpdate = this.element.className.match(/autocomplete- after-update-callback::([\S]+)/) + if (afterUpdate) options.afterUpdateElement = eval(afterUpdate [1]); + var spec = Hobo.parseModelSpec(typedId) var url = urlBase + "/" + Hobo.pluralise(spec.name) + "/ complete_" + completer var parameters = spec.id ? "id=" + spec.id : "" new Ajax.Autocompleter(this.element, this.element.next('.completions- popup'), - url, - {paramName:'query', method:'get', parameters: parameters}); + url, options); } }) The 2nd hunk adds new behavior. If you declare a <name-one class="autocomplete-select::name/>, the Ajax.Autocompleter's select option will be set. Similarly for the afterUpdateElement callback. I haven't yet found another way of specifying those. Any interest in me cleaning up and posting as a formal patch?
We're always interested in new patches. At this stage, it won't make it into Hobo 1.0, but I'd have no problem putting it into 1.0.1 if it's self-contained, like it appears to be.
A better way to do the afterUpdate hook is to use the Prototype event mechanism. See Friday's changes on github.com/tablatom/hobo for an example of and documentation for how this should work. I suspect it would look something like
options.afterUpdateElement = function(ev) { this.fire("rapid:update"); }
thanks, Bryan
-- You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/hobousers?hl=en.
