1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    25
    Vote Rating
    0
    Steve_Terry is on a distinguished road

      0  

    Default Answered: Store Date Field / Grid Date Column Not Displaying Time Correctly

    Answered: Store Date Field / Grid Date Column Not Displaying Time Correctly


    Hi there,

    So I know in terms of my title that with using date you have to be very specific (format wise) otherwise the outcome will not be as desired.

    However, currently, I am using an ajax request associated with a store which is retrieving the following date format back in json such that the actual date is for example...

    "2012-4-12 10:34:00 PM"

    In my store, I have defined the field to be...

    Code:
    [ {
       name: 'Begin Date',
       type: 'date'
       format: 'Y-m-d'
    }]
    Displaying this format in the grid (using this store) has been perfect, however, my objective is to also display the time as well so I attempted to change the date format of the store field to ...

    Code:
    [ {
       name: 'Begin Date',
       type: 'date'
       format: 'Y-m-d H:i:s'
    }]
    and adjusted the grid date column format to...

    Code:
    'Y-m-d H:i:s'
    and now the "Begin Date" column is not displaying any data at all.

    All examples I have read about online only show store date type field's using the format 'Y-m-d' so I'm wondering if it's even possible to define the date time in the store with such as defined above, I don't see why not.

    The store is set to autoload the grid on app launch.

    Thanks for any assistance.

  2. FYI: The following code works well on Chrome, Ext 4.0.7.
    Code:
    Ext.onReady(function(){
        var store = Ext.create('Ext.data.Store', {
            fields: [{
                name: 'begin', type: 'date', dateFormat: 'Y-n-d h:i:s A'
            }]
        });
        store.add({begin: '2012-4-12 10:34:00 PM'});
     
        var grid = Ext.create('Ext.grid.Panel',{
            renderTo: Ext.getBody(),
            width: 300,
            height: 200,
            store: store,
            columns:[{
                xtype: 'datecolumn',
                header: 'Begin',
                dataIndex: 'begin',
                format: 'Y-m-d H:i:s',
                flex: 1
            }]
        });
    });

  3. #2
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    FYI: The following code works well on Chrome, Ext 4.0.7.
    Code:
    Ext.onReady(function(){
        var store = Ext.create('Ext.data.Store', {
            fields: [{
                name: 'begin', type: 'date', dateFormat: 'Y-n-d h:i:s A'
            }]
        });
        store.add({begin: '2012-4-12 10:34:00 PM'});
     
        var grid = Ext.create('Ext.grid.Panel',{
            renderTo: Ext.getBody(),
            width: 300,
            height: 200,
            store: store,
            columns:[{
                xtype: 'datecolumn',
                header: 'Begin',
                dataIndex: 'begin',
                format: 'Y-m-d H:i:s',
                flex: 1
            }]
        });
    });

  4. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    25
    Vote Rating
    0
    Steve_Terry is on a distinguished road

      0  

    Default


    Thanks vietits,

    It was a simple mistake of not re-verifying what was being passed in as a request.

    The time was being passed in as "2012-4-12 10:34:00:0 PM"

    Instead of "2012-4-12 10:34:00 PM".

    Once that was fixed, it was working correctly.

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi