[Scriptaculous Autocomplete] Why cant I Override oncomplete

28 views
Skip to first unread message

anand hemmige

unread,
Aug 31, 2011, 2:05:14 PM8/31/11
to Prototype & script.aculo.us
In using the Autocompleter for my project, I have a requirement to
format the suggested items ( basically bold the characters that match
what the users typed ) . I was hoping to override the oncomplete
function which does the rendering part of the job. Then I noticed
that that the oncomplete cannot be customized by overriding and now Im
thinking about changing scriptaculous source to allow overriding.


I was curious to know if anyone knew the reasoning behind oncomplete
not being overridden. ?
Also, I would like to get opinions of members who have had to format
the output before display.

Victor

unread,
Sep 1, 2011, 2:25:29 AM9/1/11
to prototype-s...@googlegroups.com
You can highlight matched characters while creating response on the server side like in this sample:
<option><span class=\"informal\">This will not pass into answer</span><b>Highlighted part</b>Not highlighted part</option>

Victor

unread,
Sep 1, 2011, 2:32:36 AM9/1/11
to prototype-s...@googlegroups.com
Also why you cannot override some method? It is simple like

Ajax.MyAutocompleter = Class.create(Ajax.Autocompleter, {
  onComplete: function($super, request) {
    $super(request);
  }
});

or you want to replace existing method in existing class?
Reply all
Reply to author
Forward
0 new messages