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