PDA

View Full Version : ComboBox select is not a function



mohaaron
4 Aug 2009, 2:59 PM
Now that I finally have a combo filled with data I'm now receiving this error when clicking on the button to open the combo. The error is on line 54745 in ext-all-debug.js.

combo code


var shipStore = new Ext.data.JsonStore({
id: 'ShipId',
proxy: new Ext.data.HttpProxy({
url: '../WebServices/JobsWebService.asmx/GetShips'
,method: 'post'
,jsonData: {}
,headers: { 'Content-Type': 'application/json; charset=utf-8;' }
}),
root: 'd.rows',
totalProperty: 'd.totalRows',
idProperty: 'ShipId',
fields: ['ShipId', 'ShipName']
});
shipStore.load();

var shipCombo = new Ext.form.ComboBox({
id: 'shipCombo',
name: 'shipCombo',
renderTo: 'shipRenderer', // <div id="shipRenderer"></div>
valueField: 'ShipId',
displayField: 'ShipName',
hiddenName: 'ShipId', // The value that should be bound/saved.
typeAhead: true,
mode: 'remote',
editable: true,
forceSelection: true,
triggerAction: 'all',
emptyText: 'Select a ship',
store: shipStore
});

mjlecomte
4 Aug 2009, 3:03 PM
That line doesn't mean much to me, especially if I have a slightly different version than you distorting the line numbers.

Better to post an image of the stack trace and look at your own debug file and see what that line is.

mohaaron
4 Aug 2009, 3:17 PM
Here you can see the block of code and the line numbers, line 54745 is the problem. If I change forceSelection from true to false the combo does display with the error but I then get the error again if I try and select a value in the drop down.



onLoad : function(){ 54737 if(!this.hasFocus){
54738 return;
54739 }
54740 if(this.store.getCount() > 0){
54741 this.expand();
54742 this.restrictHeight();
54743 if(this.lastQuery == this.allQuery){
54744 if(this.editable){
54745 this.el.dom.select();
54746 }
54747 if(!this.selectByValue(this.value, true)){
54748 this.select(0, true);
54749 }
54750 }else{
54751 this.selectNext();
54752 if(this.typeAhead && this.lastKey != Ext.EventObject.BACKSPACE && this.lastKey != Ext.EventObject.DELETE){
54753 this.taTask.delay(this.typeAheadDelay);
54754 }
54755 }
54756 }else{
54757 this.onEmptyResults();
54758 }
54759 //this.el.focus();
54760 }

andycramb
5 Aug 2009, 1:11 AM
Your store is already loaded so try setting mode : 'local'
You have it set to remote so it will try and load the store the first time the trigger is clicked

Condor
5 Aug 2009, 1:38 AM
Which browser are you having this problem with?

The error occurs, because Ext is trying to select the text in the input element (which is something that should be supported by all major browsers).

mohaaron
5 Aug 2009, 11:37 AM
I have the combo mode set to remote so I can make this a autocomplete combo. So I would like to make it work the way it is. The browser I'm using is Firefox 3.5.2 which I would assume should work. Can you can me any tips on debugging this to help get more information about why this is happening?

mjlecomte
5 Aug 2009, 12:18 PM
post a working showcase
http://extjs.com/learn/Ext_Forum_Help#Posting_a_working_showcase

mohaaron
5 Aug 2009, 12:59 PM
OK, I just moved my code to a new page by itself and it now is working. I don't know what I changed so I'm now trying to figure out what's different. I'll post again once I know more.

For the moment I'm moving on to post another problem that I'm having.