1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    82
    Answers
    4
    Vote Rating
    3
    matfin is on a distinguished road

      0  

    Default Unanswered: controller getter and setter doesn't appear to be working

    Unanswered: controller getter and setter doesn't appear to be working


    Hi Everyone,

    Something unusual going on here and causing a bit of a headache. I have a view of type container that contains other views (lists, panels etc). Here is the code for that view.

    Code:
    
    
    Code:
    Ext.define('Application.view.Results' , {
    	extend: 'Ext.Container',
    	xtype: 'resultspanel',
    	config: {
    		id: 'resultspanel', //I put this ID in here
    		title: 'Groups',
    		layout: 'card',
    		fullscreen: true,
    		items:[
    			{
    				xtype: 'resultspanellist'
    			},
    			{
    				xtype: 'grouppanel'
    			},
    			{
    				xtype: 'fixturesresultspanel'
    			}
    		],
    		listeners: {
    			erased: function(){
    				//this.destroy();
    			}
    		}
    	},
    });
    


    I my controller, when i try to use the animateActiveItem function it doesn't work at all. I am using the built in getter and setter function and referring to the results panel above in the refs config in the controller. The code is below:

    Code:
    
    
    Code:
    refs: {
    	results: 'resultspanel',
    },


    I have written a function to switch the different xtypes contained within the results which is below but unfortunately the getter function getResults() doesn't seem to work, as in nothing happens when I tap that button that should scroll the results panel into view. The code is below

    Code:
    showResultsView: function(data, index)	{
    	var record = data.getStore().getAt(index);
    	
            //This code below here works
        	Ext.getCmp('resultspanel').animateActiveItem({
        		xtype: record.data.xtype,
        	},
        	{
        		type:'slide', direction:'left'
    });
    
            /* This commented out code here doesn't work 
            Ext.getCmp('resultspanel').animateActiveItem({    		xtype: record.data.xtype,
        	},
        	{
        		type:'slide', direction:'left'
    	});
             */
            
    
        },
    My preferred approach would be to avoid having to assign IDs to a container as it raises this error

    Code:
    [WARN][Ext.Component#constructor] Registering a component with a id (`resultspanel`) which has already been used. Please ensure the existing component has been destroyed (`Ext.Component#destroy()`.
    Can anyone see where I might be going wrong or is this a known issue in Sencha Touch 2?

    Thanks,

    Matt

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,207
    Answers
    3517
    Vote Rating
    856
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    this.getResults() doesn't return anything?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    82
    Answers
    4
    Vote Rating
    3
    matfin is on a distinguished road

      0  

    Default


    Hey,

    Yep, getResults() returns the correct object.

Thread Participants: 1

Tags for this Thread