Results 1 to 4 of 4

Thread: Override default dateFormat

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Question Override default dateFormat

    Hi,

    I'm trying to set some global defaults so I don't have to specify a reader for every form, as well as not mentioning the dateFormat for every DateField.

    The code I currently use, (and would think is correct as well) is this:

    PHP Code:
    Ext.apply(Ext.form.DateField.prototype, {
        
    format'd-m-Y G:i'
    });
    Ext.apply(Ext.data.Field.prototype, {
        
    dateFormat'U'
    }); 
    However, when I load my forms without setting a reader my DateFields do get the correct date (in the correct format), but as time they always get 0:00. Enabling the reader (code below) fixes this problem.

    PHP Code:
    reader: new Ext.data.JsonReader({
        
    root: function(v) {
            return 
    v.data ? [v.data] : [];
        },
        
    successProperty'success',
        
    fields: [{
            
    name'model'
        
    },{
            
    name'id'type'int'
        
    },{
            
    name'filename'
        
    },{
            
    name'owner'
        
    },{
            
    name'created'type'date'dateFormat'U'
        
    },{
            
    name'modified'type'date'dateFormat'U'
        
    },{
            
    name'revision'
        
    },{
            
    name'published'type'bool'
        
    }]
    }) 
    Any ideas why the DateField override works, and the Field override doesn't?

    Thanks in advance!
    Last edited by KristofTorfs; 26 Dec 2010 at 9:24 PM. Reason: Added some more info

Similar Threads

  1. Can't Override Default ToolTip Delay
    By ccocco_dw in forum Ext GWT: Discussion
    Replies: 5
    Last Post: 7 Dec 2010, 4:23 AM
  2. Override default AJAX error handler
    By Perceptive in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 24 Sep 2010, 6:06 AM
  3. Override default config values, is it possible?
    By webgunz in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 24 Dec 2007, 11:38 AM

Tags for this Thread

Posting Permissions

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