Results 1 to 4 of 4

Thread: [SOLVED]ComboBox select throws error (this.view)

  1. #1
    Ext User dotnetCarpenter's Avatar
    Join Date
    Mar 2007
    Location
    Copenhagen, Denmark
    Posts
    271

    Default [SOLVED]ComboBox select throws error (this.view)

    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):
    Code:
    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));
    		startDate.clearTime();
    		endDate.clearTime();
    		while(startDate <= endDate)
    		{
    			dates.push([startDate, startDate.format("d-m-Y")]);
    			startDate = startDate.add(Date.MONTH, 6);
    		}
    		return dates;
    	}()
    });
    And this is my comboBox:
    Code:
    var periods = new Ext.form.ComboBox({
        store: store,
        displayField:'text',
        typeAhead: true,
        mode: 'local',
        triggerAction: 'all',
        editable: false,
        forceSelection: true,
        selectOnFocus:true,
        width:90,
        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?
    Last edited by dotnetCarpenter; 10 Oct 2007 at 4:30 AM. Reason: [SOLVED]

  2. #2
    Sencha User fay's Avatar
    Join Date
    Apr 2007
    Location
    Ireland
    Posts
    1,750

    Default

    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.

  3. #3
    Ext User dotnetCarpenter's Avatar
    Join Date
    Mar 2007
    Location
    Copenhagen, Denmark
    Posts
    271

    Default

    You're right. I have moved the ,method call. I don't get an error now but nothing happens.

  4. #4
    Ext User dotnetCarpenter's Avatar
    Join Date
    Mar 2007
    Location
    Copenhagen, Denmark
    Posts
    271

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •