RetroGhost
RetroGhost

Reputation: 970

EXT4JS Name Conventions

I'm using EXTJS 4.1 and I'm naming my components as follows. If I create a store I end it with Store and I do the same for Controllers, Models, etc. So I may have UserStore.js. I then put it in a controller. Now EXTJS will create getter and setters for it but the way it does it, is they append the name "Store" to the end so I now have the following: getUserStoreStore(). Which I don't like.

But I want to append Store to my file names so I know what files I'm working in. So for example I may have a UserModel.js, UserStore.js, UserView.js, UserController.js. If I didn't I would have 4 files Called User.js and it would be a pain to always have to remember which file I'm working in.

So my question is there a config to change the way EXTJS names these getters and setters, or do I have to live with getUserStoreStore. It gets even uglier is I have sub dir under stores so for example if I have the following:

-store
 -user
  -UserStore.js
  -UserPersmission.js

I define the store like this:

Ext.define('MyApp.store.user.UserStore'

I then get the following setter:

getUserUserStoreStore()

Yuck! Any idea or do I just live with this?

Upvotes: 2

Views: 256

Answers (1)

sra
sra

Reputation: 23973

The short answer is No

You can only change it by overriding the method that creates the 'getter', cause there is no config. Other than, f.e. .Net ExtJS uses namespaces to identify the type (f.e. the controller namespace) and not a applied suffix. In addition; other suffixes are applied by the array into which the class has been placed (f.e. store, model, view).

I recommend you to just divide by namespaces.

Upvotes: 4

Related Questions