Results 1 to 3 of 3

Thread: Display cell value as a percentage.

  1. #1
    Sencha User
    Join Date
    Dec 2015
    Location
    Norther Virginia
    Posts
    15

    Default Answered: Display cell value as a percentage.

    I am simply looking to display a cell value as a percentage. I have looked through the docs and googled all morning and there are no str8forward examples of this. I've tried several ways some of which are commented out below.

    Code:
    var formatString = '0.00'; // above creating the Ext.grid.panel
    
    {
                text: 'Bounce Rate',
                flex: 1,
                dataIndex: 'bounce_rate',
                /*render: 'percent',*/
            xtype: 'numbercolumn', 
            format:'0.00',
             /*percent: function (value, formatString) {
                return me.number(value * 100, formatString || '0') + me.percentSign;
            }*/
    },
    Previous version docs had lots of code samples for stuff. 6.2 seems to provide only documentation but no samples. Does previous 6.x or 5.x release sample still apply for this type of thing?

  2. You can easily use the renderer config:



    The format string I have is '0.##%' which will only show decimal spots if they have a value. Course you could use '0.00%' to always show that precision.

  3. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379
    Answers
    3997

    Default

    You can easily use the renderer config:



    The format string I have is '0.##%' which will only show decimal spots if they have a value. Course you could use '0.00%' to always show that precision.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  4. #3
    Sencha User
    Join Date
    Dec 2015
    Location
    Norther Virginia
    Posts
    15

    Default

    Thank you!

Similar Threads

  1. Better way to display a percentage
    By jason rogers in forum Sencha Touch 2.x: Q&A
    Replies: 2
    Last Post: 10 Apr 2012, 7:51 AM
  2. How to display the loading percentage when using the loading mask?
    By jessica-qiu in forum Sencha Touch 1.x: Q&A
    Replies: 1
    Last Post: 21 Dec 2011, 7:51 PM
  3. how it display in the cell of grid
    By wdw430 in forum Ext 2.x: Help & Discussion
    Replies: 11
    Last Post: 23 Apr 2008, 5:23 AM
  4. Display a button in a cell.
    By dmayer in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 20 Sep 2007, 8:04 PM

Posting Permissions

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