We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

EJ Grid UK currency and Date Formats

We are just evolution the product and the board meet on Tuesday, I have to do a demonstration and we have a show stopper.  Im an unable to get dates to display on the grid, and the currencies are in American format.

Dates display as: /date(123456754234353)/
Currency display as $10

MVC IEnumerable model as follows:

public class ApplicationForPaymentModel
    {
        public Guid Id { get; set; }
        [Display(Name = "Application Ref")]
        public String ApplicationReference{ get; set; }
        [Display(Name = "Application Date")]
        [DataType(DataType.Date)]
        [Required]
        public System.DateTime? ApplicationDate{ get; set; }
        [Display(Name = "Valuation Period End")]
        [DataType(DataType.Date)]
        [Required]
        public DateTime? ValuationPeriodEndDate { get; set; }
        [Display(Name = "Amount")]
        [DataType(DataType.Currency)]
        [Required]
        public Decimal Amount{ get; set; }
        [Display(Name = "Application Contract To")]
        [DataType(DataType.Date)]
        [Required]
        public DateTime? ApplicationContractToDate { get; set; }
        [Required]
        [DataType(DataType.Date)]
        [Display(Name = "Payment Due Date")]
        public DateTime? PaymentDueDate { get; set; }
        [Required]
        [DataType(DataType.Date)]
        [Display(Name = "Payment Notice Date")]
        public DateTime? PaymentNoticeDate { get; set; }
        [Required]
        [DataType(DataType.Date)]
        [Display(Name = "Pay Less Notice Date")]
        public DateTime? PayLessNoticeDate { get; set; }
        [Display(Name = "Final Date For Payment")]
        [Required]
        [DataType(DataType.Date)]
        public DateTime? FinalDateForPayment { get; set; }
        public Boolean Accepted { get; set; }
    }

Grid is as follows:

$.post("@Url.Action("ArchivedApplications", "ApplicationsForPayment")",
            null,
            function (data) {
                $("#FlatGrid").ejGrid({
                    dataSource: data, // data must be array of json
                    columns: [
                       { field: "ApplicationReference", headerText: "Reference", width: 100 },
                       { field: "ApplicationDate", headerText: "Application Date", width: 80, format: "{0:dd/MM/yyyy}" },
                       { field: "Amount", headerText: "Amount", width: 100, textAlign: ej.TextAlign.Right, format: "{0:C2}" }
                    ],
                    pageSettings: { pageSize: 3 },
                    allowSorting: true,
                    allowPaging: true,
                    allowFiltering: true,
                    filterSettings: { filterType: "excel" },
                    enableAltRow: true,
                    //enablePersistence: true,
                });
        });

The script references in desktop layout include the UK localisation as per your instructions:

<script src="@Url.Content("~/Scripts/jquery-1.10.2.min.js")"></script>
    <script src="@Url.Content("~/Scripts/jsrender.min.js")"></script>
    <script src="@Url.Content("~/Scripts/jquery.easing-1.3.min.js")"></script>
    <script src="@Url.Content("~/Scripts/jquery.globalize.min.js")"></script>
    <script src="@Url.Content("~/Scripts/globalize.culture.en-GB.min.js")"></script>
    <script src="@Url.Content("~/Scripts/ej/ej.web.all.min.js")"></script>
    <script src="@Url.Content("~/Scripts/ej/ej.unobtrusive.min.js")"></script>

at the bottom of the layout:
@Html.EJ().ScriptManager()

1 Reply

RU Ragavee U S Syncfusion Team April 20, 2015 06:11 AM UTC

Hi Peter,

Thanks for your interest in syncfusion products.

Query #1: the dates and currencies are not displaying in correctly

For your kind information, we have already discussed the same issue in the below Knowledge base link. So please refer the below link to resolve the issue.

Online Knowledge Base Link: http://www.syncfusion.com/kb/3017/date-fields-in-json-data-are-not-formatted-properly-in-ajax-post

Query #2: the dates and currencies are not in UK format:

For your kind information, in order to set the localization for the grid, the locale property of the grid can be used. Please refer the below Online Knowledge base link for more information on how to enable localization in Grid.

Online Knowledge base Link: http://www.syncfusion.com/kb/4008/how-to-enable-localization-in-grid

The culture script file corresponding to the localization can be found in the below location.

Culture Script Location: C:\Program Files (x86)\Syncfusion\Essential Studio\13.1.0.21\JavaScript\assets\external\cultures

For your convenience, we have created a simple sample with the above solutions and the sample can be downloaded from the below location.

Sample Link: http://www.syncfusion.com/downloads/support/forum/118871/Sample-689940584.zip
Please get back to us if you need any further assistance.

Regards
Ragavee U S


Loader.
Live Chat Icon For mobile
Up arrow icon