View Full Version : [OPEN] Undefined reference when emptying a type ahead combo

19 Jun 2007, 7:51 AM
Hi all,

I have a combo box field which is transforming an html <select>. It works fine but when I have break-on-error enabled in firebug I get an error when I empty the combo box (using backspace).

The problem seems to by this code. fn is undefined.

6268 filterBy : function(fn, scope){
6269 var r = new Ext.util.MixedCollection();
6270 r.getKey = this.getKey;
6271 var k = this.keys, it = this.items;
6272 for(var i = 0, len = it.length; i < len; i++){
6273 if(fn.call(scope||this, it[i], k[i])){
6274 r.add(k[i], it[i]);
6275 }
6276 }
6277 return r;
6278 },

I think this is being caused by the filter function returning the result of clearFilter in this method which creates the fn variable.

createFilterFn : function(property, value, anyMatch){
10156 if(!value.exec){
10157 value = String(value);
10158 if(value.length == 0){
10159 return this.clearFilter();
10160 }
10161 value = new RegExp((anyMatch === true ? '' : '^') + Ext.escapeRe(value), "i");
10162 }
10163 return function(r){
10164 return value.test(r.data[property]);
10165 };
10166 },

Where the result of "clearFilter" I think is always undefined as it doesn't return anything. As the if condition around it is when the value length is zero this makes sense for my example.

Any finally here's a failing example

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Hello World Dialog Example</title>

<link rel="stylesheet" type="text/css" href="resources/css/ext-all.css" />

<script type="text/javascript" src="adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-all-debug.js"></script>



<span class="x-form-element" style="padding-left: 0px; position: static">
<select id="j_id39:estId" name="j_id39:estId" size="1">
<option value="ElementSet,1" selected="selected">dsa</option>
<script type="text/javascript">
var convertedCombo = new Ext.form.ComboBox({
typeAhead: true,
triggerAction: 'all',
transform: 'j_id39:estId',
forceSelection: true,
resizable: true


Just focus and backspace 3 times on the content of the combo.

Any more detail required please let me know.



19 Jun 2007, 8:02 AM
Reported an fixed already. Thanks!

8 Aug 2007, 7:43 PM
I long for how to fixed it.Anybody can tell me?

8 Aug 2007, 10:36 PM
var r=new Ext.util.MixedCollection();
var k=this.keys,it=this.items;
for(var i=0,len=it.length;i<len;i++){
here--> if(fn.call(_4e||this,it[i],k[i])){r.add(k[i],it[i]);}
return r;
I located the error and add

added--> if(typeof fn=="undefined"){
added--> r.add(k[i],it[i]);
added--> }else

:D It works!

8 Aug 2007, 11:30 PM
when developing / debugging / reporting bugs, you should use ext-all-debug.js, not ext-all.js.