1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    48
    Vote Rating
    0
    eaglefox12 is on a distinguished road

      0  

    Default Answered: How to format phone number in grid column in ext

    Answered: How to format phone number in grid column in ext


    I am trying to format phone number on a grid column from 1234567890 to 123-456-7890. I tried something of this sort to do...


    renderer: Ext.util.Format.dateRenderer('Y-m-d') but obviously this only works for date. Is there a way to render phone numbers?

  2. Lots of ways to do it... Here's one:

    Code:
    renderer: function(value) {
        return value.replace(/^(\d{3})(\d{3})(\d{4})$/, '$1-$2-$3');
    }

  3. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,592
    Answers
    541
    Vote Rating
    323
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    Lots of ways to do it... Here's one:

    Code:
    renderer: function(value) {
        return value.replace(/^(\d{3})(\d{3})(\d{4})$/, '$1-$2-$3');
    }

  4. #3
    Sencha User
    Join Date
    Sep 2012
    Posts
    48
    Vote Rating
    0
    eaglefox12 is on a distinguished road

      0  

    Default


    Quote Originally Posted by skirtle View Post
    Lots of ways to do it... Here's one:

    Code:
    renderer: function(value) {
        return value.replace(/^(\d{3})(\d{3})(\d{4})$/, '$1-$2-$3');
    }
    Thank you skirtle... much appreciated

Thread Participants: 1

Tags for this Thread