PDA

View Full Version : Separate Combobox and Autocomplete



peterchenping
1 Jun 2007, 10:27 AM
I think ext team need to separa Combobox and Autocomplete feature to make thing simple. I played ext.form.combobox for a few days, I was never able to cache query data that come from the sever. YUI 2.2 already has this auto cache data feature, but through the adapter the thing has been change.


here is YUI cofiguration for autocomplete.

YAHOO.example.ACFlatData = function(){
var mylogger;
var oACDS;
var oAutoComp1;

return {
init: function() {
oACDS = new YAHOO.widget.DS_XHR("./php/ysearch_flat.php", ["\n", "\t"]);
oACDS.responseType = YAHOO.widget.DS_XHR.TYPE_FLAT;
oACDS.maxCacheEntries = 100;
oACDS.queryMatchSubset = true;

// Instantiate second AutoComplete
oAutoComp1 = new YAHOO.widget.AutoComplete('ysearchinput1','ysearchcontainer1', oACDS);
oAutoComp1.delimChar = "";
oAutoComp1.useShadow = true;
oAutoComp1.formatResult = 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='ysearchresult'><div class='ysearchquery'>",
nQuantity,
"</div><span style='color:blue; font-weight: bold;'>",
sKeyQuery,
"</span>",
sKeyRemainder,
"</div>"];
return (aMarkup.join(""));
};
oAutoComp1.itemSelectEvent.subscribe(itemSelectHandler);
},

validateForm: function() {
// Validate form inputs here
return false;
}
};
}();

YAHOO.util.Event.addListener(this,'load',YAHOO.example.ACFlatData.init);

manugoel2003
2 Jun 2007, 8:59 AM
I would like to second this thought.... I have been trying to figure out a way to implement autosuggestion in EXT but am not quite there yet.... I mean, simple autosuggestion is fine, but what about advanced features like - delimiter character, query delay, forced selection, caching, auto highlight, typeahead, etc etc.... so I just ended up using YUI itself for autosuggestion.... is it possible to do all that in Ext? if so, can anyone point me in the right direction?.... if not, then it would be really nice to have those features..... keep up the good work

sjivan
2 Jun 2007, 9:49 AM
Several of the options you mention seem to be available in the Ext ComboBox

http://extjs.com/deploy/ext-1.0.1/docs/output/Ext.form.ComboBox.html#configs

Sanjiv

manugoel2003
2 Jun 2007, 10:18 AM
funny.... how did I miss those.... were they added in the last 2 weeks?.... sorry guys, for posting without Xchecking.... I'll give it a try.... thanx sanjiv

sanjay
8 Jun 2007, 4:41 AM
Hi...Is there any way to have delimeters in the autosuggestion. We require it so that we can allow users to select multiple values in a single column. If anybody have done so...please let us have the code...or guide us how to do this.........

manugoel2003
8 Jun 2007, 8:31 PM
ya.... u mean like in the email text box.... I remember requesting this a while back.... has anyone tried this yet?

manugoel2003
23 Jun 2007, 2:07 AM
Hi everyone, has anyone tried implementing delimiters? ... I am pretty bad at JavaScript so even after trying my bit in extending the combobox class couldn't quite achieve it.... if anyone else has done anything in it then please let me know