<script type="text/javascript">
YAHOO.example.ACFlatData = new function(){
// Define a custom formatter function
this.fnCustomFormatter = function(oResultItem, sQuery) {
var sKey = oResultItem[0];
var nQuantity = oResultItem[1];
var sKeyQuery = sKey.substr(0, sQuery.length);
var sKeyRemainder = sKey.substr(sQuery.length);
var aMarkup = ["<div class='sample-result'><div class='sample-quantity'>",
nQuantity,
"</div><span class='sample-query'>",
sKeyQuery,
"</span>",
sKeyRemainder,
"</div>"];
return (aMarkup.join(""));
};
// Instantiate one XHR DataSource and define schema as an array:
// ["Record Delimiter",
// "Field Delimiter"]
this.oACDS = new YAHOO.widget.DS_XHR(backend_url, ["\n", "\t"]);
this.oACDS.responseType = YAHOO.widget.DS_XHR.TYPE_FLAT;
this.oACDS.maxCacheEntries = 60;
this.oACDS.queryMatchSubset = true;
// Instantiate third AutoComplete
this.oAutoComp2 = new YAHOO.widget.AutoComplete(element_name,element_name, this.oACDS);
this.oAutoComp2.queryDelay = 0;
this.oAutoComp2.delimChar = "";
this.oAutoComp2.prehighlightClassName = "yui-ac-prehighlight";
this.oAutoComp2.formatResult = this.fnCustomFormatter;
};
</script>