|
Title: datagrid - format a value Post by: stephenl on December 15, 2024, 12:02:13 PM Hello
I have a datagrid defined as below Code: columns:[[ Currently, Open_Amt format shows as 12345.5 I would like to format value this to show 12,345.50 ie always show 2 places after the decimal point and also show thousands separator Suggestions appreciated Thank you Title: Re: datagrid - format a value Post by: jega on December 15, 2024, 01:19:17 PM Hi.
Use formatter like {field:'Open_Amt',title:'Amt',width:5, align:'right',formatter:formatOpenAmt}, function formatOpenAmt(row){ var formattedString = [Find the code you need. There is a lot of possibilities] return formattedString; } Look at demo/datagrid/format datagrid columns OR If you pull Open_Amt from a database, the format in in your sql so json is already formatted Title: Re: datagrid - format a value Post by: stephenl on December 15, 2024, 01:37:00 PM If you pull Open_Amt from a database, the format in in your sql so json is already formatted ??? Great Idea - Thanks ! Title: Re: datagrid - format a value Post by: jega on December 16, 2024, 04:07:37 AM You got the point, even if my text was incorrect spelled.
For others. If data to datagrid is from a database, then format it directly in your SQL or make a view with the formated columns, and return the formatted JSON data directly to the datagrid. Please mark topic as [SOLVED] ;-) |