1. #1
    Sencha User
    Join Date
    Jan 2013
    Location
    cebu, philippines
    Posts
    2
    Vote Rating
    0
    ynan is on a distinguished road

      0  

    Default Ext.grid.GridPanel Showing NaN Date on IE

    Ext.grid.GridPanel Showing NaN Date on IE


    function renderDate(value) { return Ext.util.Format.date(value, 'F d, Y g:i A'); }
    this.testsGrid = new Ext.grid.GridPanel({ id: 'testsGrid', region: 'center', deferRowRender: true, store: this.testsStore, loadMask: true, viewConfig: { forceFit: true }, autoWidth: true, columns: [ { id: 'LogId', header: 'Log ID', sortable: true, dataIndex: 'LogId' }, {id: 'ShortName', header: 'Short Name', sortable: true, dataIndex: 'ShortName' }, { id: 'LogInDate', header: 'Log Date', sortable: true, dataIndex: 'LogInDate', renderer: renderDate } ], stripeRows: true, autoScroll: true, border: false });

    Above code will show correct date format on Chrome but will only display NaN on IE. Can somebody help me? Thanks...

  2. #2
    Sencha User
    Join Date
    Jan 2013
    Location
    cebu, philippines
    Posts
    2
    Vote Rating
    0
    ynan is on a distinguished road

      0  

    Default


    value by the way has this value '2012, 02, 30'

    I really need a help.

  3. #3
    Sencha User
    Join Date
    Jan 2011
    Posts
    544
    Vote Rating
    52
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default


    The value to format (Strings must conform to the format expected by the javascript Date object's parse() method)
    http://docs.sencha.com/ext-js/3-4/#!...at-method-date

    http://www.w3schools.com/jsref/jsref_parse.asp

    You cannot supply the date format as '2012, 02, 30' - this is an invalid format.

    Example:
    http://jsfiddle.net/qex8D/2/

  4. #4
    Sencha User
    Join Date
    Oct 2007
    Location
    Berlin, Germany
    Posts
    891
    Vote Rating
    9
    wm003 will become famous soon enough

      0  

    Default


    If by 2012,02,30 the 30th of March(!) is meant then he could simply try

    PHP Code:
    function renderDate(value) {return Ext.util.Format.date(eval("new Date("+value+")"), 'F d, Y g:i A');} 
    it's quickn dirty, but should work.

Thread Participants: 2

Tags for this Thread