-
9 Apr 2012 2:10 PM #1
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:
Model:Code:var catalogoStore = new Ext.data.Store ({ autoLoad: true, model: 'catalogoModel', proxy: { type: 'ajax', url: 'get-images.php', reader: { type: 'json', root: 'images' } } });
View:Code:Ext.regModel('catalogoModel', { fields: [ 'name', 'url', { name: 'size', type: 'float' }, { name: 'lastmod', type: 'date', dateFormat: 'timestamp' }, 'thumb_url' ] });
I hope you can help me.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);
Thanks in advance.
-
Best Answer Posted by mitchellsimoens
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.
-
10 Apr 2012 8:47 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,684
- Vote Rating
- 435
- Answers
- 3111
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
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
10 Apr 2012 9:09 AM #3
Thanks mitchellsimoens, now my code is like this, but the error still persists:
What else need to do?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); } });
Thanks.
-
10 Apr 2012 10:37 AM #4
Ok, my error was in my html definition, had a reference to *.js useless.
Thanks for everything.


Reply With Quote