Wednesday, March 28, 2012

Extending Autocomplete: Customizing markup

I'm using the script.aculo.us Autocomplete because it is more flexible than the AjaxToolkit Autocomplete... or is it?

My question is, can I get the Toolkit Autocomplete to do the same sort of things as script.aculo.us?

http://demo.script.aculo.us/ajax/autocompleter_customized

In the above demo, start typing "ada" in the field. Notice how each item in the list is customised: each item has an image, some bold text (the name) and some other text (the email). This is because script.aculo.us gets HTML returned (e.g. from an <asp:Repeater>) RATHER THAN a string array from a webservice. This means you have complete control over WHAT each item looks like and contains. Sure, they are building in CSS support for the Toolkit version, but you still don't have control over what's contained in each listitem (i.e. defining the markup for each item). I use the scipt.aculo.us Autocomplete by having some hidden elements, too, so I can store Ids along with displaying the text.

I'm looking for something similar to <ItemTemplate> for Autocomplete, similar to the <ItemTemplate> for the Repeater and GridView controls.

If this is "too hard" to implement then why have this statement on the toolkit project page (http://www.codeplex.com/Wiki/View.aspx?ProjectName=AtlasControlToolkit)

"the Toolkit aims to be the biggest and best collection of web-client components available."

Well, at the moment, I can name one Autocompleter out there which does a better job than the toolkit one: script.aculo.us. Don't take it the wrong way, I really like the toolkit and I really wouldrather use the toolkit than script.aculo.us, but at the moment, the toolkit version doesn't have the same amount of flexibility.

Hello? Anyone have a comment on this?


Hi,

There is a workitem open for the same issue over at codeplex .

HTML-Tag for AutoComplete List

http://www.codeplex.com/AtlasControlToolkit/WorkItem/View.aspx?WorkItemId=9339

You can vote for it so that someone picks it up or contribute your own patch to extend the ACE to incorporate this behavior.

No comments:

Post a Comment