View Full Version : [SOLVED]ComboBox select throws error (this.view)

10 Oct 2007, 3:31 AM
Hi all!

I have a comboBox bound to a SimpleStore and I get an error when I use the select method of the comboBox. In firebug: this.view has no properties
This is my data (store):

var store = new Ext.data.SimpleStore({
fields: [ 'date', 'text' ],
data: function(){
var dates = new Array();
var startDate = new Date(Date.UTC(2006, 0, 0));
var endDate = new Date(Date.UTC(startDate.getUTCFullYear()+2, 6, 0));
while(startDate <= endDate)
dates.push([startDate, startDate.format("d-m-Y")]);
startDate = startDate.add(Date.MONTH, 6);
return dates;
And this is my comboBox:

var periods = new Ext.form.ComboBox({
store: store,
typeAhead: true,
mode: 'local',
triggerAction: 'all',
editable: false,
forceSelection: true,
name: 'periods',

Now if I use this periods.select(2, true); anywhere after the above code, I get an this.view has no properties exception. It looks like a comboBox expects the underlaying data store to have a view, but which store has that?

10 Oct 2007, 3:38 AM
Assuming that the combobox is part of a form, you will get this error message if you call periods.select() before the form is rendered.

10 Oct 2007, 3:53 AM
You're right. I have moved the ,method call. I don't get an error now but nothing happens.

10 Oct 2007, 4:02 AM
ok I didn't expect that behavior. I found the div and the class for my element does change to x-combo-selected but the container div is hidden. I'm must be missing a setting