1. #1
    Sencha User
    Join Date
    Jun 2013
    Posts
    4
    Answers
    1
    Vote Rating
    0
    yuhanli85 is on a distinguished road

      0  

    Default Answered: A problem about click button to load store

    Answered: A problem about click button to load store


    I want show this page, and when i click button 'btn', the list will show the data. But it's not work. I think it's because of 'config', but i don't how to correct.
    Code:
    Ext.define('Garuda.view.MainPage',{	extend: 'Ext.tab.Panel',
    	xtype: 'mainPage',
    	config: {
    		tabBar: {
                docked: 'bottom',
                layout: {
                    pack: 'center',
                    align: 'center'
                },
                scrollable: {
                    direction: 'horizontal',
                    indicators: false
                }
            },
    		ui: 'light',
    		defaults: {
                scrollable: true
            },
            items: [
            	Ext.create('Ext.NavigationView', {
    	    		title: 'User',
    	    		iconCls: 'organize',
    				autoDestroy: false,
    	    		items: [
    					{
    						xtype: 'panel',
    					    layout: 'fit',
    					    items: [
    					        {
    					            xtype: 'button',
    					            id: 'btn',
    					            text: '搜索',
    					            docked: 'top',
    					            handler: function() {
    					            	console.log("sdfasdfsdf");
    					            	var store = Ext.getStore('Device');
    					            	store.load({
    							    		params: {'sqlFilter': ''}
    							    	});
    					            }
    					        },
    							Ext.create('Ext.dataview.List',{  
    								itemTpl: [
    									'<h3>{deviceName}</h3>',
    									'<h4>{deviceStatusDesc}, {ifHost}</h4>',
    									'<h4>{devTel}, {qryTel}</h4>'
    								],
    								store: 'Device'  
    							})
    					    ]
    					}
    				]
    	    	}),
                {
                    title: 'Favorites',
                    html: '<h1>Favorites Card</h1>',
                    iconCls: 'favorites',
                    cls: 'card2',
                    badgeText: '4'
                }
            ]
    	}
    })
    By the way , i try another way and it's work.
    Code:
    Ext.Viewport.add(Ext.create('Garuda.view.MainPage',{
    			tabBar: {
    	            docked: 'bottom',
    	            layout: {
    	                pack: 'center',
    	                align: 'center'
    	            },
    	            scrollable: {
    	                direction: 'horizontal',
    	                indicators: false
    	            }
    	        },
    			ui: 'light',
    			defaults: {
    	            scrollable: true
    	        },
    	        items: [
    	        	Ext.create('Ext.NavigationView', {  
    		    		title: 'User',
    		    		iconCls: 'organize',
    					autoDestroy: false,
    		    		items: [
    						{
    							xtype: 'panel',
    						    layout: 'fit',
    						    items: [
    						        {
    						            xtype: 'button',
    						            text: '搜索',
    						            docked: 'top',
    						            handler: function() {
    						            	console.log("sdfasdfsdf");
    						            	var store = Ext.getStore('Device');
    						            	store.load({
    		    		params: {'sqlFilter': ''}
    		    	});
    						            }
    						        },
    						        Ext.create('Ext.dataview.List',{  
    							itemTpl: [
    								'<h3>{deviceName}</h3>',
    								'<h4>{deviceStatusDesc}, {ifHost}</h4>',
    								'<h4>{devTel}, {qryTel}</h4>'
    							],
    							store: 'Device'  
    						})
    						    ]
    						}
    					]
    		    	}),
    	            {
    	                title: 'User',
    	                html: '<h1>User Card</h1>',
    	                iconCls: 'user',
    	                cls: 'card5'
    	            }
    	        ]
    		}
    		));

  2. I get that error if I mistyped a method name in the control config.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,408
    Answers
    3549
    Vote Rating
    851
    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


    You should not use Ext.create like that but use simple config objects
    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.

  4. #3
    Sencha User
    Join Date
    Jun 2013
    Posts
    4
    Answers
    1
    Vote Rating
    0
    yuhanli85 is on a distinguished road

      0  

    Default


    I get that error if I mistyped a method name in the control config.

Thread Participants: 1

Tags for this Thread