Search code examples
extjs4.1phone-number

How to format phone number in grid column in ext


I am trying to format phone numbers in 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?


Solution

  • For others who need it, here's the solution for phone number

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