[CLOSED] ProgressBarColumn percentage problem

  1. #1

    [CLOSED] ProgressBarColumn percentage problem

    Hi,

    i use ProgressBarColumn in gridpanel and when i set progressbar dataindex by percentage it seems like integer but my datavalue is float.

    Example; datavalue= 56,37 but it seems 5637%

    how can i set percentage value to progressbar?
    Last edited by Daniil; Mar 17, 2014 at 8:02 AM. Reason: [CLOSED]
  2. #2
    Hi @ddeniz,

    A ProgressBarColumn supports float values and it expects values less than 1.
    https://examples2.ext.net/#/GridPane...ressBarColumn/

    The lowest division is 1 percent.

    If you need to changed the behavior, you can override a ProgressBarColumn's Renderer.

    Ext.define('MyOverrides', {
        override: "Ext.ux.grid.column.ProgressBar",
    
        renderer: function (value, meta) {
            var me = this,
                text,
                cls = me.progressCls,
                pCls,
                cWidth = me.getWidth(true) - 2;
    
            if (me.hideIfEmpty && (!value && value !== 0 || value < 0)) {
                return "";
            }
    
            value = value || 0;
    
            text = Ext.String.format(me.progressText, Math.round(value * 100)); //you should change this line
    
            pCls = cls + ' ' + cls + '-' + me.ui;
            meta.tdCls = "x-progress-column-cell";
            meta.style = "padding:0px;margin:0px;";
            v = '<div class="' + pCls + '" style="margin:1px 1px 1px 1px;width:' + cWidth + 'px;"><div class="' + cls + '-text ' + cls + '-text-back" style="width:' + (cWidth - 2) + 'px;">' +
                    text +
                '</div>' +
                '<div class="' + cls + '-bar ' + cls + '-bar-' + me.ui + '" style="width: ' + value * 100 + '%;">' +
                    '<div class="' + cls + '-text" style="width:' + (cWidth - 2) + 'px;">' +
                        '<div>' + text + '</div>' +
                    '</div>' +
                '</div></div>'
            return v;
        }
    });
  3. #3
    Thank you @Daniil

Similar Threads

  1. How to set Panel height in percentage
    By Mr.Techno in forum 1.x Help
    Replies: 0
    Last Post: Feb 06, 2012, 11:44 AM
  2. Height , Width in percentage
    By AnandVishnu in forum 1.x Help
    Replies: 1
    Last Post: Oct 31, 2011, 1:48 PM
  3. How to define width in percentage
    By ACustodio in forum 1.x Help
    Replies: 3
    Last Post: Jul 29, 2011, 9:02 PM
  4. Position as percentage
    By kpcrash in forum 1.x Help
    Replies: 2
    Last Post: Nov 17, 2009, 3:07 PM
  5. [CLOSED] Border Layout percentage
    By GmServizi in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Oct 22, 2009, 7:51 AM

Posting Permissions