Results 1 to 3 of 3

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

  1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    48
    Vote Rating
    1
      0  

    Default 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,790
    Answers
    583
    Vote Rating
    390
      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
    1
      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

Tags for this Thread

Posting Permissions

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