PDA

View Full Version : What Ties a JSON Name/Value Pair to a File?



dkahl
24 Oct 2012, 2:27 PM
I've gone through the MVC tutorial using its naming conventions; however, that results in 3 files named "User.js". MS VisualStudio shows only the name.extension in each file's tab. You have to hover over each tab to see which specific User.js file it is.

I thought that in the ..\controler\Users.js file that if I changed
models: [ 'Users']
to
models: ['mdlUsers']
and renamed my model's file to ..\model\mdlUser.js that that would cause Ext to use the renamed file, but it doesn't. So, what really maps/ties models: to a file?

Thanks!

evant
24 Oct 2012, 2:37 PM
1) Might have been a typo, but the file name would need to be mdlUsers.

2) You also need to change the class name in the file, so it would be:



Ext.define('MyApp.model.mdlUsers');


Because of the model namespace, the 'mdl' doesn't really add much.

dkahl
24 Oct 2012, 3:05 PM
1) Might have been a typo, but the file name would need to be mdlUsers.

2) You also need to change the class name in the file, so it would be:



Ext.define('MyApp.model.mdlUsers');


Because of the model namespace, the 'mdl' doesn't really add much.

Evan,
Thanks for your reply. Based on your reply, I did the following:
1. I changed controller file to ... models: ['mdlUser'] ... , did a copy/paste of mdlUser string, renamed model file using copied string.
2. changed the class name in the renamed model file (mdlUser.js) again using the copied string.

Chrome console window still shows my app is looking for ../model/user.js :-/

evant
24 Oct 2012, 4:09 PM
What about the store? It specifies model.User as the model, which means it's going to require it.

dkahl
25 Oct 2012, 6:25 AM
What about the store? It specifies model.User as the model, which means it's going to require it.

Hi Evan,
Yep, that was it. Both the controller AND the store have to point to the same model.

Thanks,
Daryl