user1694873
user1694873

Reputation: 473

Backgrid wont render date values from database

Im new to backGrid and im very impressed with what it can do so far.

I have successfully got some data from my Database back to my web-app in JSON and all renders ok with the exception of a date column which will throws an error:

Object 1361561820000 has no method 'trim' Heres is the column:

var columns = [{
name: "dateTime",
label: "Date/Time",
cell: 'date'
}];

This will render ok on the page when cell is set to 'string' but obviously this doesnt display in date format..

Is there anyway around this?

Previously i used a standard html table and parsed the date column with: $.format.date(get('dateTime'), 'dd/MM/yyyy hh:mm:ss' but i seem unable to apply this now,

Any help much appreciated

Upvotes: 3

Views: 619

Answers (1)

Y.H Wong
Y.H Wong

Reputation: 7244

All of the core datetime cells will only accept datetime values in ISO-8601 format. Timestamps are not supported. To make the datetime cells to accept UNIX timestamps, you will have to override the formatter.

Upvotes: 2

Related Questions