-
15 Nov 2012 10:37 AM #11
Schildi,
I'll try to address your various parts of your message individually. Hopefully we can get it all figured out in the end!
You're right, I misspoke. I didn't have the model "require"d in the app.js. I had it as:
in the app.js, and had it as:Code:models: [ 'Animals']
in the Animals.js store.Code:require: ['Blue.model.Animals']
In your next statement, I have the Animals.js store also as a config object in the app.js as:
You're correct. I went back in and changed all of my folders within the app directory to be singular, without an "s" at the end of the name. So, the name of my file is "Animals.js", and it's within the "app/store" directory, and it's configured under the "stores" parameter in app.js.Code:stores: ['Animals']
In your example of creating the list, it doesn't seem to be able to find that store when doing what you coded. I continually get the error of:
I also went ahead and dropped the ID property in the store, since it wasn't really necessary, as you stated.[WARN][Ext.dataview.List#applyStore] The specified Store cannot be found
I have it set up now that the store requires the model, but the model is not requiring the store.
I'll try to debug some more via the console in Chrome, and see if that gets me any farther. Hopefully this information can give you a better idea of what the issue is as well.
Thanks for your help!
-
16 Nov 2012 2:05 AM #12
Hi slmckenzie,
hmm, this is strange.
I quickly created an app-structure, which implements things roughly as you need them. Maybe you can look at this again and compare it to your implementation. Also take care of foldernames etc. (plural s or no plural s).
This version does work
:
File: app.js
File: app/view/Menu.jsCode:Ext.application({ name: 'App', views: ['Menu'], stores: ['Animals'], launch: function() { Ext.Viewport.add(Ext.create('App.view.Menu')); } });
File: app/model/Animal.jsCode:Ext.define('App.view.Menu', { extend: 'Ext.Container', config: { layout: 'fit', items: [ { xtype: 'list', store: 'Animals', itemTpl: '<b>{id}</b> {name}' } ] } });
File: app/store/Animals.jsCode:Ext.define('App.model.Animal', { extend: 'Ext.data.Model', config: { fields: [ { name: 'id', type: 'int' }, { name: 'name', type: 'string' } ] } });
File: animals.php (to simulate loading data from a server/database)Code:Ext.define('App.store.Animals', { extend: 'Ext.data.Store', requires: ['App.model.Animal'], config: { model: 'App.model.Animal', autoLoad: true, proxy: { type: 'ajax', url: 'animals.php', reader: { type: 'json' } } } });
Good luck and best regardsCode:<?php echo json_encode( array( array( 'id' => 1, 'name' => 'Dog' ), array( 'id' => 2, 'name' => 'Cat' ), array( 'id' => 3, 'name' => 'Cow' ) ) ); ?>
Schildi
-
16 Nov 2012 7:23 AM #13
So, I eventually gave up and started completely over from scratch again. I followed the "Getting Started" app, and built it up from there (previously I had included the entire SDK package, vs. generating an app instead).
After doing so, I realized that I think I had "require", instead of "requires" as a configuration setting in the various . JS files! That was probably my demise when trying to get everything working. So, a combination of verifying that was correct, plus starting over, plus generating the app shell using the command line tools, seemed to take care of the problem for me!
All is well, I'm a few thousand lines of code in, multiple view / stores later, and everything is working like a champ. Thanks all for your help!
-
16 Nov 2012 7:52 AM #14
Mmmh, that damned "s"

But nice to hear that it works now.
Best regards,
Schildi
-
22 Nov 2012 4:27 AM #15
thanks
thanks
thanks



Reply With Quote