Hybrid View

  1. #1
    Sencha User
    Join Date
    May 2010
    Location
    Dallas, TX
    Posts
    67
    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;
    }
    
    }

  3. #2
    Sencha User
    Join Date
    Jul 2012
    Posts
    33
    Answers
    4
    Vote Rating
    4
    Alexander Bauer is on a distinguished road

      2  

    Default


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

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

  4. #3
    Touch Premium Member
    Join Date
    Feb 2011
    Location
    NJ
    Posts
    311
    Answers
    59
    Vote Rating
    52
    droessner is a jewel in the rough droessner is a jewel in the rough droessner is a jewel in the rough

      1  

    Default


    Make sure you do parseInt(value, 10) so that it parses as a decimal.

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

      0  

    Default


    Thanks for the replies.


    I think I see how this works. I'm a little new to the syntax of value === 0 ? "" : value;


    Once I added that renderer to my column, the cell is now showing NaN.


    *EDIT* BAH! User error. This works like a charm!

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi