1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    3
    Vote Rating
    0
    Jeep15603 is on a distinguished road

      0  

    Question Answered: Object references

    Answered: Object references


    I am new to ExtJS, and there is something basic I'm not getting about object references.

    I have a chart named ChartDog, which is attached to a store and shared with a grid, declared like so:
    var chartDog = Ext.create('widget.panel', { ... the chart itself is working fine.

    so later on if I want to change something on its series (or anything else) I ought to be able to do this:
    ChartDog.series.get('style').stroke = '#f00'; or Ext.Cmp('ChartDog') ...

    but I can't because on ANY reference I get an error like "ChartDog is undefined"....that goes for any local var for any template, etc. Why is everything undefined?

  2. That's because "ChartDog" is not the same named reference as "chartDog". JavaScript is case sensitive.

    Instances of classes should begin with lower case.

    Ext.Cmp is an invalid method.

    Also, do not use static ids for components.

  3. #2
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,170
    Vote Rating
    32
    Answers
    83
    jay@moduscreate.com is just really nice jay@moduscreate.com is just really nice jay@moduscreate.com is just really nice jay@moduscreate.com is just really nice

      0  

    Default


    That's because "ChartDog" is not the same named reference as "chartDog". JavaScript is case sensitive.

    Instances of classes should begin with lower case.

    Ext.Cmp is an invalid method.

    Also, do not use static ids for components.

    Jay Garcia @ModusJesus || Modus Create co-founder
    Ext JS in Action author
    Sencha Touch in Action author

    Get in touch for Ext JS & Sencha Touch Touch Training

    We are also working on Video-based Sencha Touch training: Check it out here.

  4. #3
    Sencha User
    Join Date
    Jan 2012
    Posts
    3
    Vote Rating
    0
    Jeep15603 is on a distinguished road

      0  

    Default


    Good catch ... thank you.

  5. #4
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,170
    Vote Rating
    32
    Answers
    83
    jay@moduscreate.com is just really nice jay@moduscreate.com is just really nice jay@moduscreate.com is just really nice jay@moduscreate.com is just really nice

      0  

    Default


    Please mark this thread as answered so folks who monitor the forums don't waste time.

    Jay Garcia @ModusJesus || Modus Create co-founder
    Ext JS in Action author
    Sencha Touch in Action author

    Get in touch for Ext JS & Sencha Touch Touch Training

    We are also working on Video-based Sencha Touch training: Check it out here.