Grid Telephone Number Format Need To Be Changed

This Home Phone and Business Phone format need to be changed to this format (Mentioned below).

Needed Format - 



There is a space between (402) and 741-2244 in above screenshot and it also needed.

Currently telnumbers are string type


Thank you. 



1 Reply 1 reply marked as answer

FS Farveen Sulthana Thameeztheen Basha Syncfusion Team July 22, 2022 02:24 PM UTC

Hi Kavishka,


Query#:-This Home Phone and Business Phone format need to be changed to this format (Mentioned below).


We have achieved your requirement using QueryCellInfo event of the Grid. In this event, you can customize the values of the cells. Similary we have changed the value of corresponding column into Telephone format.


Refer to the code example.

<ej:Grid ID="FlatGrid" runat="server" AllowPaging="True" AllowScrolling="True" AllowFiltering="False" AllowReordering="False" AllowSorting="True" AllowSelection="True" Selectiontype="Multiple" >

       <ClientSideEvents QueryCellInfo="queryCellInfo" />

           <Columns>

                <ej:Column Field="Id" HeaderText="Order ID" Width="90"  IsPrimaryKey="True" Visible="false" />

                <ej:Column Field="Name" HeaderText="Customer ID" Width="85"/>

                <ej:Column Field="OrderDate" HeaderText="Employee ID" Width="70"/>

                

               

            </Columns>

 

  </ej:Grid>

 

<script>

    function queryCellInfo(args) {

        if (args.column.field == "HomePhone") {    //corresponding fieldName

            var text = args.text.replace(/^(\d{3})(\d{3})(\d{4}).*/, "($1) $2-$3");   //Telephone number format

            $(args.cell).text(text);

        }

    }

</script>

 


API link:-https://help.syncfusion.com/api/js/ejgrid#events:querycellinfo


Also in your screenshot we suspect that you need to customize like the same in Excel Filter. By default, we have performed grid actions such as searching, filtering etc based on the grid dataSource. So The values present in Grid dataSource for the corresponding field will be displayed in dataSource of Excel Filter checkboxList. Hence It is not feasible to customize the Excel Filter values.


Please get back to us if you need any further assistance.


Regards,

Farveen sulthana T


Marked as answer
Loader.
Up arrow icon