1. #1
    Ext JS Premium Member
    Join Date
    Jun 2011
    Posts
    14
    Vote Rating
    2
    emilianm is on a distinguished road

      0  

    Default Best xtype naming conventions for our custom components

    Best xtype naming conventions for our custom components


    What are the best naming conventions for our custom widgets ?

    Normally in ExtJs all widgets are using lower-case. This is very easy for the default widgets that are usually made as a concatenation off two very short words (ex: 'textfield').

    How should we proceeded when our components names are much more longer and with multiple words ?Is CamelCase a solution or should we use the same '.' as a separator ?For this second solution (with '.') we could also very easy replicate the package structure (namespace) of the class definition to make the association between the widget name and the calss name much more easier...?



    I know that we have some guidelines here http://docs.sencha.com/ext-js/4-0/#/guide/class_system , but they are not really talking about widgets.

  2. #2
    Touch Premium Member
    Join Date
    Feb 2011
    Location
    NJ
    Posts
    310
    Vote Rating
    50
    droessner is a jewel in the rough droessner is a jewel in the rough droessner is a jewel in the rough

      0  

    Default


    I don't think there is any "best" naming convention. I would just go with something you feel comfortable with and then stay consistent throughout your application.

  3. #3
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,677
    Vote Rating
    749
    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

      1  

    Default


    Something descriptive... it is a common practice to have your XType match your Class name except be all lowercase...

    Class name: MyCompany.apps.Contacts
    XType: mycompany.apps.contacts
    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. #4
    Ext JS Premium Member
    Join Date
    Jun 2011
    Posts
    14
    Vote Rating
    2
    emilianm is on a distinguished road

      0  

    Default


    Thank you for your responses it is exactly what we wanted to use. But this is very easy for the cases when we have a single word for the name of the class, if we have two or even three we have to use CamelCase for the name of the widget ...

  5. #5
    Ext JS Premium Member
    Join Date
    Jun 2011
    Posts
    14
    Vote Rating
    2
    emilianm is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    Something descriptive... it is a common practice to have your XType match your Class name except be all lowercase...

    Class name: MyCompany.apps.Contacts
    XType: mycompany.apps.contacts
    It seems that if we you use a dot in the xtype name the ComponentQuery fails. Do you have any idea why ? Is this a bug ..if yes is this resolved in one of the last release (4.0.5)?
    Thanks!

  6. #6
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,677
    Vote Rating
    749
    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


    Quote Originally Posted by emilianm View Post
    It seems that if we you use a dot in the xtype name the ComponentQuery fails. Do you have any idea why ? Is this a bug ..if yes is this resolved in one of the last release (4.0.5)?
    Thanks!
    You're correct! Been using Ext JS 3 a lot lately again

    What I have done is replace with underscores:

    Class name: MyCompany.apps.Contacts
    XType: mycompany_apps_contacts

    Don't like it as much as periods but it doesn't make a difference really. Have seen some people use dashes '-' just like you would in CSS which is what ComponentQuery is modeled after to have the same feel.
    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.

  7. #7
    Sencha User
    Join Date
    Mar 2010
    Posts
    2
    Vote Rating
    0
    zendmania is on a distinguished road

      0  

    Default


    just use [xtype="mycompany.apps.contacts"] instead of mycompany.apps.contacts in queries.
    Check this thread for details:
    http://www.sencha.com/forum/showthread.php?132643-EXTJSIV-1804-Ext.ComponentQuery.query%28%29-for-ItemId-s-xtypes-containing-./page3

    that's works fine for example in "refs" of controllers.

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar