Results 1 to 1 of 1

Thread: problem when rendering date

  1. #1
    Ext User
    Join Date
    Aug 2009
    Posts
    14
    Vote Rating
    0
      0  

    Default problem when rendering date

    hello all
    i m having huge problems when trying to render a date into my grid.
    it's always getting rendered as NaN...
    here's my json response

    Code:
    [{"id": "1","description": "description1","provisionAmount": "1.0","user": "user1","provisionType": "HOUSE_INSURANCE","provisionDate": "Thu Sep 03 21:53:17 BST 2009"}]
    here's my extjs code (i have tried every possible renderer)

    Code:
    var dsProvisions = new Ext.data.JsonStore({
          proxy: new Ext.data.HttpProxy({url: '../provision-data/LoadProvisions.do'}),
          root:'model.provisionList',
          id:'id',
          fields:
          [ {name: 'id' , mapping:'id'},
            {name: 'description', mapping: 'description'},
    	    {name: 'provisionType', mapping: 'provisionType'},
          	{name: 'provisionAmount' , mapping:'provisionAmount'},
          	{name: 'provisionDate', mapping:'provisionDate'},
          	{name: 'username' , mapping:'user'}]
        }); 
    
    var cmProvisions = new Ext.grid.ColumnModel([
    		    {header: 'Id', type:'long',width: 80, sortable: true, dataIndex: 'id'},
    	        {header: 'Description', type:'string',width: 120, sortable: true, dataIndex: 'description'},
    			{header: 'Type', type:'string',width: 120, sortable: true, dataIndex: 'provisionType'},
    			{header: 'Amount', type:'double', width: 90, sortable: true, dataIndex: 'provisionAmount'},
    			{header: 'Date', type:'string', width: 90, sortable: true, dataIndex: 'provisionDate', renderer:formatDate},
    			{header: 'User', type:'string', width: 90, sortable: true, dataIndex: 'username'},
    			
    		]);
    
    function formatDate(value){
      	   
            alert('date is:' + value);
    	var newValue = Ext.util.Format.date(value);
    	alert('new value is:' + newValue);
            return Ext.util.Format.date(value, 'd-m-Y H:i:s');
      }

    In the format date, the first alert is fine but the second always return NaN......

    anyone could help?

    regards
    marco
    Last edited by VinylFox; 3 Sep 2009 at 1:40 PM. Reason: added CODE tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •