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

Grid does not show UK currency or date

I have just logged this and nothing is appearing under my threads!!! The board meet on Tuesday to decide if we are going ahead with this product and we have a show stopper.

I am using EJGrid and the dates and currencies are not displaying in correctly and in UK format:

Currency: $10.00
Date: /date(123123123123)/

Innumerable MVC object returned in json:

 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 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,
                });
        });

layout as follows:

    <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>

1 Reply

RU Ragavee U S Syncfusion Team April 20, 2015 06:10 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.
Up arrow icon