1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    15
    Answers
    1
    Vote Rating
    0
    mfruizs2 is on a distinguished road

      0  

    Default Unanswered: I can't use Ext.Util.TextMetrics ... why ?

    Unanswered: I can't use Ext.Util.TextMetrics ... why ?


    I'm trying to use the methods form Ext.util.TextMetrics,

    code:
    Code:
      this.setTitle("Hi!");
      var width = Ext.util.TextMetrics.getWidth(this.title);
      this.setWidth(width);


    on chrome debugger:


    Code:
    >"Ext.util.TextMetrics: function () {"

    but when expand that function do nothing... can't invoke any method, i got a Exception problem on that code:




    and this is the exception that throw:




    Code:
    extjs/src/chart/Tip.js?_dc=1347004442226:86
    Uncaught TypeError: Object function () {                return this.constructor.apply(this, arguments);            }

    on console, expanded:




    Code:
    has no method 'getWidth' app/view/myFolder/Reports.js?_dc=1347004442419:86
    items.items.series.tips.renderer app/view/myFolder/Reports.js?_dc=1347004442419:86
    Ext.define.showTipextjs/src/chart/Tip.js?_dc=1347005147139:86
    Ext.define.onItemMouseOverextjs/src/chart/series/Series.js?_dc=1347005147142:258
    fireext-debug.js:16976
    Ext.define.continueFireEventextjs/src/util/Observable.js?_dc=1347005146725:291
    Ext.define.fireEventextjs/src/util/Observable.js?_dc=1347005146725:264
    (anonymous function)extjs/src/chart/Chart.js?_dc=1347005147137:612
    Ext.define.eachextjs/src/util/AbstractMixedCollection.js?_dc=1347005146698:230
    Ext.define.onMouseMoveextjs/src/chart/Chart.js?_dc=1347005147137:595
    fireext-debug.js:16976
    Ext.define.continueFireEventextjs/src/util/Observable.js?_dc=1347005146725:291
    Ext.define.fireEventextjs/src/util/Observable.js?_dc=1347005146725:264
    Ext.override.fireEventextjs/src/app/EventBus.js?_dc=1347005147078:35
    (anonymous function)extjs/src/draw/Component.js?_dc=1347005146951:236
    fireext-debug.js:16976
    Ext.define.continueFireEventextjs/src/util/Observable.js?_dc=1347005146725:291
    Ext.define.fireEventextjs/src/util/Observable.js?_dc=1347005146725:264
    Ext.define.onMouseMoveextjs/src/draw/Surface.js?_dc=1347005146984:468
    (anonymous function)
    wrap

    ¿Any idea why it happens ?

    thx

  2. #2
    Sencha User
    Join Date
    Nov 2011
    Location
    Cuttack,Odisha,India
    Posts
    61
    Vote Rating
    1
    debabrata is on a distinguished road

      0  

    Default


    HAve you tried getSize function ?

  3. #3
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    Ext.util.TextMetrics is a class, not an object, and getWidth() is not a static method. So you should create an instance from it. Example:
    Code:
    var tm = Ext.create('Ext.util.TextMetrics');
    console.log(tm.getWidth('123456789'));