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
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Answers
    102
    Vote Rating
    77
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      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.

  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
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Answers
    102
    Vote Rating
    77
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


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

Thread Participants: 1

Tags for this Thread