1. #1
    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  

    Question id vs itemId

    id vs itemId


    We are currently developing a new front-end for our application using Ext. The main layout will have a tab panel in the center of the viewport and may have another tab panel within each tab. Those subtabs will then have different options with submittable forms for example. I have been writing all my forms using itemId for all of my items and referencing them using the .down function. Another developer working on this project has been using id and putting a prefix in front of the id of every item based on the tab/subtab that the item is in and then referencing the item directly using the id. I understand that both of these approaches work and that technically neither is incorrect. However, I would like to get some feedback on which would be better to use for a large application and why. The API Docs all seem to hint towards using itemId over id so that unique ids are not accidentally repeated which would cause issues, but putting a prefix on each id based on the tab would solve that problem. What are the other reasons for using itemId over id? Also, is the time it takes to reference items using the itemId significantly slower than just referencing the item directly using the id, or is this not something to worry about?

    Thanks,
    Danny

  2. #2
    Sencha User castitas's Avatar
    Join Date
    Sep 2011
    Location
    US
    Posts
    116
    Vote Rating
    2
    castitas is on a distinguished road

      0  

    Default


    +1

  3. #3
    Sencha User
    Join Date
    Jul 2011
    Posts
    72
    Vote Rating
    3
    ragecf is on a distinguished road

      0  

    Default


    I'd like to know this too, anyone and explain?

  4. #4
    Sencha User
    Join Date
    Nov 2013
    Location
    India
    Posts
    8
    Vote Rating
    0
    megm is on a distinguished road

      0  

    Default Item id vs id

    Item id vs id


    Just started working on Sencha. I have the same query!!

  5. #5
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,195
    Vote Rating
    104
    LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light

      0  

    Default


    There's no performance difference between using id and itemId.

    When you use an id for a component, there must be a single instance of this component, so it's recommended to avoid using ids.

    itemId must be unique only within the component's immediate container.

  6. #6
    Sencha Premium Member
    Join Date
    Jan 2008
    Location
    San Francisco Bay, CA
    Posts
    41
    Vote Rating
    1
    rgralhoz is on a distinguished road

      0  

    Default


    Using id could lead to future bugs due to name collision, as the application grows, components get reused, development teams grows and people get reallocated. Your colleague's approach relies on tracking a list of already used prefixes / ids.

    Sencha recommends to avoid using id on the AbstractComponent.id API and on the blog (item #6).

    Other related links:
    http://www.sencha.com/forum/showthre...1-itemId-vs-id
    http://softdevbuilttolast.wordpress....s-you-have-to/

  7. #7
    Sencha Premium Member varsos's Avatar
    Join Date
    Feb 2008
    Location
    Long Island, NY
    Posts
    327
    Vote Rating
    10
    varsos is on a distinguished road

      0  

    Default


    ItemId is unique and local to the container where id is unique globally.

    If you know the container of the component you are looking for, then using getComponent(itemId) should be faster because it will traverse less items in its HashMap, it is only looking for direct child components.

    If you do not know the container then you can use getCmp(). But if you are doing this a lot or in a loop, it would be better to get the container by getCmp() first, then get the child components by getComponent(itemId).

    The components of an app are in a hierarchy. However if you only know a very top level component, to get to the bottom components may require multiple getComponent() calls or Ext.ComponentQuery calls, making the code complex. There is also a very nasty side-effect, if you rearrange any of the hierarchy you code will break. Rearranging a component hierarchy may happen when an app allows re-positioning of the components, or it may happen as a result of an application enhancement. So traversing using multiple getComponent calls or using Ext.componentQuery.query this way is not always a good idea. Using both getCmp and getComponent in a way that minimizes rigidity of the app is best.
    varsos

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