0

I am using spring mvc with jquery grid. I have a date field in my row. in Json I get the date as

"releaseDate":1406399400000

But it shows as "NaN/NaN/NaN" in the table. In my bean class I keep it as java Date format. grid configuration column model is as follows.

colModel:[
               {name:'name', label: 'Product Name', width: 300},

               {name:'releaseDate', label: 'Release Date',formatter:'date',formatoptions: {newformat:'m/d/Y'}, width: 300}

           ],

I am using jqgrid 4.6. Any help is really appreciated.

Thank You!

user1438823
  • 1,273
  • 3
  • 18
  • 25

1 Answers1

0

You can use for example custom formatter which calls formatter: "date" with srcformat: "u" property in formatoptions. Try something like

{
    name: 'releaseDate',
    label: 'Release Date',
    formatoptions: {newformat:'m/d/Y'},
    formatter: function (value, options) {
        if (typeof value === "number" && value > 1000000000000) {
            return $.fn.fmatter.call(this, "date", value/1000, options);
        } else {
            return " ";
        }
    },
    width: 300
}

In case of string input value you can use parseInt. Probably you will have to provide unformat and sorttype as function too.

Oleg
  • 220,925
  • 34
  • 403
  • 798