Results 1 to 7 of 7

Thread: How to add a class to the element class in EXTJs

  1. #1

    Default How to add a class to the element class in EXTJs

    I'm using a chart to render a piechart for my app. I have:


    HTML Code:
       Ext.query('.highcharts-container')
    that gives me an array of highchart-containers and I'd like to add a custom class to every one of them to add some custom css. I tried:


    HTML Code:
      Ext.query('.highcharts-container').addCls("test")
    but says "addCls" is not a function.
    any ideas how can i add class?

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    If addCls isn't an available method, perhaps the container is not an Ext JS container?

  3. #3

    Default

    Quote Originally Posted by Gary Schlosberg View Post
    If addCls isn't an available method, perhaps the container is not an Ext JS container?
    below is the whole function for creating the chart. is there a way to add a class to this one?
    HTML Code:
       addPieChart: function() {
            Ext.select('.highcharts-container').addCls("test");            
            this.addChart(Qx.chart.Highchart.Configs.get('donut', {
                    chart: {                    
                        //some code                
                     },                
                     tooltip: {                   
                       //some code               
                     },               
                     plotOptions: {                   
                           pie: {                       
                               //some code                        
                           }                   
                      }               
                }            
        }), "pie", pieData, w, h);        
    },

  4. #4
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    Is the container created by Ext JS?

  5. #5

    Default

    I think its a built-in class for the high charts and should be coming from there. if so isnt there a way to add class to this cont?

  6. #6
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    If the container isn't created by Ext JS, then I would recommend adding it outside of the framework. You could access the className of the element and append your class name to it (separated by a space).

  7. #7

    Default

    Can you plz show with an example?

Similar Threads

  1. Ext get element by class name
    By Sejal in forum Ext 3.x: Help & Discussion
    Replies: 14
    Last Post: 5 Jul 2016, 12:33 AM
  2. add class to element
    By nofx in forum Sencha Touch 1.x: Discussion
    Replies: 5
    Last Post: 15 Oct 2014, 1:00 AM
  3. Replies: 1
    Last Post: 16 Jan 2014, 12:58 AM
  4. Replies: 1
    Last Post: 27 Apr 2011, 4:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •