1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    104
    Answers
    4
    Vote Rating
    0
    izak18 is on a distinguished road

      0  

    Default Answered: Problem Getting Images - Gallery PHP

    Answered: Problem Getting Images - Gallery PHP


    Hi everybody, I have a problem, I tried to show a simple panel with some images, I found a code on the Web and Im using a php to get the images, I also see this example in Sencha Documentation.
    I don't know what I doing wrong ... could you tell me what is the error in my code please?.
    I got a error "Uncaught Attempting to extend from a class which has not been loaded on the page" but still I can show the images.

    This is my code:

    Store:
    Code:
    var catalogoStore = new Ext.data.Store ({
        autoLoad: true,
        model: 'catalogoModel',
        proxy: {
            type: 'ajax',
            url: 'get-images.php',
            reader: {
                type: 'json',
                root: 'images'
            }
        }
    });
    Model:
    Code:
    Ext.regModel('catalogoModel', {    fields: [
            'name', 'url',
            { name: 'size', type: 'float' },
            { name: 'lastmod', type: 'date', dateFormat: 'timestamp' },
            'thumb_url'
        ]
    });
    View:
    Code:
    var tpl = new Ext.XTemplate(    '<tpl for=".">',
            '<div class="thumb-wrap" id="{name}">',
            '<div class="thumb"><img src="{thumb_url}" title="{name}"></div>',
            '<span class="x-editable">{shortName}</span></div>',
        '</tpl>',
        '<div class="x-clear"></div>'
    );
    
    
    var datav = new Ext.DataView({
        autoScroll: true,
        store: catalogoStore,
        tpl: tpl,
        autoHeight: false,
        height: 400,
        multiSelect: true,
        overItemCls: 'x-view-over',
        itemSelector: 'div.thumb-wrap',
        emptyText: 'No images to display',
        style: 'border:1px solid #99BBE8; border-top-width: 0',
    })
    
    
    var buttonsSpecTop = [{
        ui: 'back',
        text: 'Volver',
        handler: function()
            {
                window.open("menu.html","_self");
            }
        },
        {
            xtype: 'spacer'
        }
    ]
    
    
    var dockedItems = [{
        xtype: 'toolbar',
        title: 'Catálogo',
        ui: 'dark',
        dock: 'top',
        items: buttonsSpecTop
    }]
    
    
    catalogoView = Ext.extend(Ext.Panel, 
    {
        fullscreen: true,
        layout: 'card',
            
        initComponent: function() 
        {
            this.crearDocPanel = new Ext.Panel(
            {
                layout: 'card',
                dockedItems: dockedItems,
                items: datav
            });
            
            this.items = this.crearDocPanel;
            catalogoView.superclass.initComponent.call(this);
        }
    });
    
    
    Ext.reg('catalogoView', catalogoView);
    I hope you can help me.
    Thanks in advance.

  2. You need to clean your code up. Your DataView needs to be created within your panel extension but your panel extension has a card layout within a card layout.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Answers
    3541
    Vote Rating
    847
    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 need to clean your code up. Your DataView needs to be created within your panel extension but your panel extension has a card layout within a card layout.
    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
    Mar 2012
    Posts
    104
    Answers
    4
    Vote Rating
    0
    izak18 is on a distinguished road

      0  

    Default


    Thanks mitchellsimoens, now my code is like this, but the error still persists:

    Code:
    catalogoView = Ext.extend(Ext.Panel, {
    	fullscreen: true,
    	layout: 'card',
    		
    	initComponent: function() 
    	{
    		this.datav = new Ext.DataView({
    		autoScroll: true,
    		store: catalogoStore,
    		tpl: tpl,
    		autoHeight: true,
    		height: 400,
    		itemSelector: 'div.thumb-wrap',
    		emptyText: 'No hay imágenes para mostrar',
    		style: 'border:1px solid #99BBE8; border-top-width: 0',
    		});
    		
    		this.crearDocPanel = new Ext.Panel(
            {
                dockedItems: dockedItems,
                items: this.datav
    		});
            
            this.items = this.crearDocPanel;
            catalogoView.superclass.initComponent.call(this);
    	}
    });
    What else need to do?
    Thanks.

  5. #4
    Sencha User
    Join Date
    Mar 2012
    Posts
    104
    Answers
    4
    Vote Rating
    0
    izak18 is on a distinguished road

      0  

    Default


    Ok, my error was in my html definition, had a reference to *.js useless.
    Thanks for everything.

Thread Participants: 1

Tags for this Thread