1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    43
    Vote Rating
    0
    durgaprasadn is on a distinguished road

      0  

    Default extjs date column grid panel format issue. {"updatedOn":1335156222983} - json data.

    extjs date column grid panel format issue. {"updatedOn":1335156222983} - json data.


    Hello Team,

    I am trying to display the createdOn and updatedOn in the grid panel and I am not able to render it on the grid. Any suggestions/pointers to solve this problem would be appreciable.

    When I looked into the database code, I have seen the service while inserting the updatedOn or createdOn, they are creating a calendar.getInstance().getTime() and storing the value and return value from the service is in the Date.

    my json data is as follows:

    {"totalRecords":1,"errorMessage":null,"success":null,"vanityUrls":[{"description":"","locale":"EN_FR","updatedBy":"","vanityUrl":"rediff","linkUrl":"rediff.com","updatedOn":1335156222983,"linkId":29944,"createdBy":"","businessUnitId":0,"sourceCode":"","comments":"rediff1","linkType":8,"divisionId":0}]}

    model fields for date, createOn and updatedOn:
    Ext.define('VanityUrl', {
    extend: 'Ext.data.Model',
    idProperty:'linkId',
    fields: [
    {name: 'createdOn', type: 'date', dateFormat: 'Y-m-d H:i.u'}, // not sure I am doing correct. please suggest.
    {name: 'updatedOn', type: 'date', dateFormat: 'Y-m-d H:i.u'}// not sure I am doing correct. please suggest.
    ]
    });

    column definition in grid panel store.
    {
    header: "Updated On",
    width: 100,
    sortable: true,
    dataIndex: 'updatedOn',
    renderer: Ext.util.Format.dateRenderer('Y-m-d') // not sure I am doing correct. please suggest.}


    --Durga

  2. #2
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Vote Rating
    109
    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


    Code:
    {"totalRecords":1,"errorMessage":null,"success":null,"vanityUrls":[{"description":"","locale":"EN_FR","updatedBy":"","vanityUrl":"rediff","linkUrl":"rediff.com","updatedOn":1335156222983,"linkId":29944,"createdBy":"","businessUnitId":0,"sourceCode":"","comments":"rediff1","linkType":8,"divisionId":0}]}
    It seems that updatedOn is milisecond timestamp. If so, you should define dateFormat as 'time'
    Code:
    Ext.define('VanityUrl', {
        extend: 'Ext.data.Model',
        idProperty:'linkId',
        fields: [
            {name: 'createdOn', type: 'date', dateFormat: 'time'},
            {name: 'updatedOn', type: 'date', dateFormat: 'time'}
        ]
    });

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    43
    Vote Rating
    0
    durgaprasadn is on a distinguished road

      0  

    Default


    Thanks vietits for your response. Always your replies just fit into my solution straight. I appreciate your knowledge and time sir.

    --Durga

  4. #4
    Sencha User
    Join Date
    Oct 2012
    Posts
    4
    Vote Rating
    0
    jnkrana is on a distinguished road

      0  

    Default not working for me

    not working for me


    My grid :
    header : "Processed Date",
    dataIndex : 'processedDate',
    sortable : false,
    renderer: Ext.util.Format.dateRenderer('d-m-Y'),

    Model:
    'processedDate', {
    name : 'date',
    type: 'date',
    dateFormat: 'time'
    }

    processdDate is coming via json in this format :1350560184000
    Help me....already have tried with many thing....

  5. #5
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Vote Rating
    109
    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


    @ jnkrana,

    What is your problem? It's better to post your complete code instead of just a piece of code and try to put them in CODE tag.

  6. #6
    Sencha User
    Join Date
    Oct 2012
    Posts
    4
    Vote Rating
    0
    jnkrana is on a distinguished road

      0  

    Default


    I am having same issue with above posted by Durga.
    I have pasted my grid column and model data but not working at all based on your solution.
    On grid, its shows me like this ...NaN-Nan-Nan...
    Let me know how can you help me.

  7. #7
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Vote Rating
    109
    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


    You should post your complete model, grid and json data for getting help. I don't understand your model code:
    Code:
    'processedDate', {
    name : 'date',
    type: 'date',
    dateFormat: 'time'
    }

  8. #8
    Sencha User
    Join Date
    Oct 2012
    Posts
    4
    Vote Rating
    0
    jnkrana is on a distinguished road

      0  

    Default


    here you go...
    Model:
    Code:
    Ext.define('ImageModel', {
            extend : 'Ext.data.Model',
            idProperty : 'RecordNumber',
            fields : [ 'exceptionNumber', 'filename',
                        'recordNumber',  {
                            name : 'size',
                            type : 'float'
                        }, 'processedDate', {
                            name : 'date',
                            type: 'date',
                            dateFormat: 'time'
                    }],
        });
    grid :

    Code:
                                    xtype: 'gridpanel',
                                    title : 'Exception List',
                                    store : exceptionstore,
                                    columns : [ {
                                        header : 'Sr.No.',
                                        xtype: 'rownumberer',
                                        width: 50,
                                        sortable: false
                                    },{
                                        header : "Exception Number",
                                        dataIndex : 'exceptionNumber',
                                        sortable : false,
                                   }, {
                                        header : "Record Number",
                                        dataIndex : 'recordNumber',
                                        sortable : false,
                                        
                                    }, {
                                        header : "Processed Date",
                                        dataIndex : 'processedDate',
                                        sortable : false,
                                        renderer: Ext.util.Format.dateRenderer('d-m-Y'),
                                    } ],
    let me know how can you help me..

  9. #9
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Vote Rating
    109
    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

      1  

    Default


    You did not define type for the processedDate field so it will be set to auto by default.
    Try to fix your code as below:
    Code:
    Ext.define('ImageModel', {
        extend : 'Ext.data.Model',
        idProperty : 'RecordNumber',
        fields : [ 
            'exceptionNumber',
            'filename',
            'recordNumber',
            {
                name : 'size',
                type : 'float'
            }, 
    //      'processedDate', 
            {
                name : 'processedDate',
                type: 'date',
                dateFormat: 'time'
            },
            {
                name : 'date',
                type: 'date',
                dateFormat: 'time'
            }
        ]
    });

  10. #10
    Sencha User
    Join Date
    Oct 2012
    Posts
    4
    Vote Rating
    0
    jnkrana is on a distinguished road

      0  

    Default


    @vietits

    Thank you very much...its was my fault and silly mistake...

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar