I was getting stack overflows if I typed in something that would return
a zero-length DataTable. the updateList() and show() methods on the
AutoCompleteDataTable wanted to infinitely call each other.
To avoid problems upgrading I don't want to edit my autocomplete.js, so
in my aspx page I override the ondata method, as below. Note I also
overrided the changeHighlight method so that I won't need to come up
with a special CSS file that knows the strange IDs autogenerated by
ASP.Net.
x.getDisplay = function(item) {
return (item != null ? item.DisplayText : "");
}
x.getValue = function(item) {
return (item != null ?
item.ShortDescription.toString().trimRight() :
"");
}
x.getData = function() {
ASP.AutoCompleteWebForm.GetDeductions(this.ele.value,
this.callback.bind(this));
}
// Override the ondata function to work around stack overflows.
x.ondata = function() {
if(this.getLength()>0)
this.updateList();
}
x.changeHighlight = function() {
var l = 0;
l = this.getLength();
// alert(l);
for(var i=0; i<this.count && i<l; i++) {
if(i == this.pos)
this.div.childNodes[i].style.cssText = "font-family:
Verdana, Arial,
Helvetica, sans-serif;font-size:
11px;
background-color:White;cursor:hand;padding-left:2px;height:16px;background-color:Blue;color:White;";
else
this.div.childNodes[i].style.cssText = "font-family:
Verdana, Arial,
Helvetica, sans-serif;font-size:
11px; background-color:White;cursor:hand;padding-left:2px;height:16px;";
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ajax.NET Professional" 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/ajaxpro
The latest downloads of Ajax.NET Professional can be found at
http://www.ajaxpro.info/
Don't forget to read my blog at http://weblogs.asp.net/mschwarz/
-~----------~----~----~----~------~----~------~--~---