jQuery UI Widgets › Forums › Grid › Issue with a field Date
Tagged: angularjs gridview, date, grid, grid component, jquery grid
This topic contains 4 replies, has 2 voices, and was last updated by Peter Stoev 11 years, 5 months ago.
-
AuthorIssue with a field Date Posts
-
Hello everybody,
I’m starting with JQwidgets and I got this issue when I was loading a Grid with a Json from the database….
I’m retrieving a field DateTime from the database but in the grid it is showing as /Date(142384005160)
If any one have any idea of what I should do to show a readable date I will appreciate their help!!
this is the code that I’m writing in the column grid:
$.ajax({
type: “POST”,
url: “/AccountHistory/LoadAccountHistory”,
data: params,
contentType: “application/json; charset=utf-8”,
dataType: “json”,
success: function (data) {
var source = { localData: data, dataType: “array” };
var dataAdapter = new $.jqx.dataAdapter(source);
$(“#gvHistory”).jqxGrid({
width: “100%”,
source: dataAdapter,
altrows: true,
sortable: true,
selectionmode: ‘singlerow’,
pageable: true,
pagesize: 20,
columns: [
{ text: ‘System#’, datafield: ‘TransmitterCode’, sortable: true, groupable: true, exportable: true },
{ text: ‘Date’, datafield: “HistoryDate”, sortable: true, groupable: true, exportable: true, cellsformat: “M/d/yyyy h:mm tt”, width: 200 },
{ text: ‘Event/Op Action’, datafield: ‘EventOpAct’, sortable: true, groupable: true, exportable: true },
{ text: ‘Zone’, datafield: ‘Point’, sortable: true, groupable: true, exportable: true },
{ text: ‘Description’, datafield: ‘PointDescription’, sortable: true, groupable: true, exportable: true },
{ text: ‘User Name’, datafield: ‘UserName’, sortable: true, groupable: true, exportable: true },
{ text: ‘Area’, datafield: ‘AreaNum’, sortable: true, groupable: true, exportable: true },
{ text: ‘Comment’, datafield: ‘HistoryCommentBig’, sortable: true, groupable: true, exportable: true },
]
});
}
});Hi jperera,
The problem is that the provided Grid initialization is incorrect. You should define datafields array and set the name and type of each datafield in the adapter’s source object.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comThank you, could you send me an example or a link with an example please?
Thank your very much Peter, I solve the problem thank you very much again, just one thing when I call to the method that load the grid all the details show up open and when I load the grid for first time every detail is close??
Thank you.Hi jperera,
Here’s documented what I meant: http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-datasources.htm. Please, follow the same guidelines when binding jqxGrid to a data source.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.