Threaded View

  1. #1
    Sencha User
    Join Date
    May 2010
    Location
    Dallas, TX
    Posts
    68
    Answers
    6
    Vote Rating
    1
    rkanemeier is on a distinguished road

      0  

    Default Answered: Suppress 0 In Grid Column

    Answered: Suppress 0 In Grid Column


    I have a db file that contains a 3 digit number field (no decimals). If this field is "empty", naturally the value is 0. When I display this field in a grid, it shows up as 0. Instead of displaying 0, I want the field to display as blank. If the value is 3, it should show 3 (not 003). How do I suppress a value of zero (and any leading zeros) in a grid column? I tried searching for this answer but came up empty.

  2. You can specify a custom renderer on a column, i.e.:

    Code:
    {
    // ...
    
    renderer : function(value) {
    value = parseInt(value);
     return value === 0 ? "" : value;
    }
    
    }

Thread Participants: 2