Open wickstargazer opened 10 years ago
This is how i solved it in the render function
switch (col.type) { case 'date': var value = self.getPropByStr(self.model.attributes, col.name); if (value) { var regex = /-?\d+/; var m = regex.exec(value); var datetimeValue = new Date(parseInt(m[0])); if (col.dateformat) { //datetimeValue.format(col.dateformat); } col.value = datetimeValue; } break; default: col.value = self.getPropByStr(self.model.attributes, col.name); break; }
putting this into the config for column
{ title: 'Published Date', name: 'PublishedOn', index: true, sorttype: 'date', type: 'date', dateformat: 'dd/m/yy' }
Lastly for the formatting
if (col.dateformat) { if (!$.datepicker) throw new Error("Cannot format date, please include jquery datepicker, column name : " + col.name ); datetimeValue = $.datepicker.formatDate(col.dateformat, datetimeValue); }
Hi, i am using bbgrid in c# MVC development. The problem i get is, the Date(xxxx) the json data gets back from the server is not rendered as date in the grid.
I am trying to find a way to solve it.
By the way, i have added a couple of events in the bbgrid code, like such
to help sustain some events after the page changes or sorting is commenced. If you would like me to submit up to branch, will do so :)