1. #1
    Ext User
    Join Date
    Mar 2010
    Posts
    23
    Vote Rating
    0
    DominateQ is on a distinguished road

      0  

    Default daterender in xgcolumnmodel problem NaN/NaN/NaN

    daterender in xgcolumnmodel problem NaN/NaN/NaN


    Hello all,
    I'm new on this forum so please help me. I try to use daterenderer in a columnmodel but when I read the date from the server i allways get NaN/NaN/NaN.
    Here is my code.
    If you need somethig more please tell me.
    How can I see a valid date. To edit or to sane a new date is working.
    I have only problems to display it. I read some other posts but i couldn't find a solution to my problem.

    Thanks,

    PHP Code:
        var cm=new xg.ColumnModel([
            {
                
    dataIndex:'id_incident',
                
    hidden:truedefaultValue:ID_INCIDENT,
                
    hideable:false
            
    },{
                
    header"User"dataIndex'user_fullname',
                
    searchable:truesortabletruealign:'center'width:100fixedtrue,
                
    defaultValue:LOGGED_USER.user_fullname,
                
    hiddenId:'id_user',
                
    hiddenValue:LOGGED_USER.id_user
            
    },{
                
    header"Equipment"dataIndex'equip_name',
                
    searchable:truewidth:420,
                
    defaultValue:'Add equipment',
                
    err:'Select equipment !',
                
    editor: new Ext.form.Equip({name'id_equip',displayField:'equip_name',allowBlank:false}),
                
    hiddenId:'id_equip'
            
    },{
                
    header"Whats wrong"dataIndex'equip_defect',
                
    searchable:truewidth:420
                
    defaultValue:'Whats wrong',
                
    editor: new Ext.form.TextField({allowBlankfalse,maxLength:100})
            },{
                
    header"Serial n."dataIndex'equip_serial',
                
    searchable:truesortabletruewidth:120fixedtruealign'center',
                
    defaultValue:"N/A",
                
    editor: new Ext.form.TextField({allowBlankfalse,maxLength:50})
            },{ 
            
    dataIndex'equip_sent_date'id'quip_sent_date',header'Date'width300,
            
    rendererExt.util.Format.dateRenderer('d/m/Y'),
            
    editor: new Ext.form.DateField({format'd/m/Y'}),
            
    sortabletrue
            
    }
        ]);

        
    store['equip'+ID_INCIDENT] = new Ext.data.Store({
            
    proxy: new Ext.data.HttpProxy({url'data.php?mode=load_form&form=incident_equip'}),
            
    reader: new Ext.data.JsonReader({
                
    root'results',
                
    totalProperty'count',
                
    id'id_incident_equip'
            
    },[{name:'equip_sent_date'type:'date'},'id_incident_equip','id_incident','id_user','id_equip','equip_name','equip_serial','incident_equip_date','equip_defect']),
            
    sortInfo:{field:'incident_equip_date'direction:'ASC'}
        }); 
    [IMG]file:///C:/DOCUME%7E1/admin/LOCALS%7E1/Temp/moz-screenshot-5.png[/IMG]screen1.JPG

  2. #2
    Sencha User
    Join Date
    Jan 2008
    Location
    Maryville, IL, US
    Posts
    288
    Vote Rating
    0
    httpdotcom is on a distinguished road

      0  

    Default


    Did you set dateFormat in your store's field configuration, so Ext knows what it is getting "coming in", so it can then render it "going out"?

  3. #3
    Ext User
    Join Date
    Apr 2010
    Posts
    1
    Vote Rating
    0
    kathkath is on a distinguished road

      0  

    Red face I had the same problem

    I had the same problem


    You have to define the dateFormat in data JsonStore

    fields: [ {name:'date', type: 'date', dateFormat: 'Y-m-d H:i'}]
    The date that come in is "2011-11-20 00:00:00" in my program. You have to define the same format .

  4. #4
    Ext User
    Join Date
    Mar 2010
    Posts
    23
    Vote Rating
    0
    DominateQ is on a distinguished road

      0  

    Default


    PHP Code:
    if($_GET['form']=="incident_equip")
                { 
    //@@@@@@@@ 
                    
    $data['fields']="*,
                    IF(equip_sent_date,UNIX_TIMESTAMP(equip_sent_date),'') as equip_sent_date,
                    UNIX_TIMESTAMP(incident_equip_date) as incident_equip_date"
    ;
                    
    $data['tables'].=",user,equip";
                    
    $data['conditions']="incident_equip.id_user=user.id_user and incident_equip.id_equip=equip.id_equip";
                } 

  5. #5
    Ext User
    Join Date
    Mar 2010
    Posts
    23
    Vote Rating
    0
    DominateQ is on a distinguished road

      0  

    Default


    Quote Originally Posted by kathkath View Post
    You have to define the dateFormat in data JsonStore

    fields: [ {name:'date', type: 'date', dateFormat: 'Y-m-d H:i'}]
    The date that come in is "2011-11-20 00:00:00" in my program. You have to define the same format .

    I've also tried :

    PHP Code:
    {name:'equip_sent_date'type:'date'dateFormat'Y-m-d H:i:s.u'
    or
    PHP Code:
    {name:'equip_sent_date'type:'date'dateFormat'Y-m-d H:i:s'
    but doesn't work

  6. #6
    Sencha User
    Join Date
    Jan 2008
    Location
    Maryville, IL, US
    Posts
    288
    Vote Rating
    0
    httpdotcom is on a distinguished road

      0  

    Default


    Show your JSON output.

  7. #7
    Sencha User issameddine's Avatar
    Join Date
    Apr 2008
    Location
    Tunisia
    Posts
    126
    Vote Rating
    1
    issameddine is on a distinguished road

      0  

    Default


    use this function in render

    Code:
    column:
    { 
            dataIndex: 'equip_sent_date', id: 'quip_sent_date',header: 'Date', width: 300,
            renderer: renderDate ,
            editor: new Ext.form.DateField({format: 'd/m/Y'}),
            sortable: true
            }
    
    // Function
    renderDate = function (v,params,record)
    {
        var dt = new Date(v);    					    
        return dt.format('d/m/Y'); 
    }

  8. #8
    Ext User
    Join Date
    Mar 2010
    Posts
    23
    Vote Rating
    0
    DominateQ is on a distinguished road

      0  

    Default


    Hello all,
    Thank you for the your help this far.
    My problem stillpersists but somehow is different now.
    I will explain:

    PHP Code:
    if($_GET['form']=="incident_equip")
                {   
    $data['fields']="*,
                    IF(equip_sent_date,UNIX_TIMESTAMP(equip_sent_date),'') as equip_sent_date,
                    UNIX_TIMESTAMP(incident_equip_date) as incident_equip_date"
    ;
                    
    $data['tables'].=",user,equip";
                    
    $data['conditions']="incident_equip.id_user=user.id_user and incident_equip.id_equip=equip.id_equip";
                } 
    The renderer:

    PHP Code:
        datestamp:function(value) {
            
    value=value?new Datevalue*1000 ).format("d-m-Y"):'N/A';
            return 
    value; } 
    and the xgColumn
    PHP Code:

            
    dataIndex'equip_sent_date'id'equip_sent_date',header'Date'width300,
            
    rendererrenderers.datestamp,
            
    editor: new Ext.form.DateField({format'd/m/Y'}),
            
    sortabletrue
            

    The renderer i use it from some examples that i find on the internet.
    The problem now is that it displays all the informations correctly but when i try to edit it doesn't work.
    Please help:
    I attached some printscreens:

    1. It displays the dates correctly:

    img1.JPG

    2. It displays the datepicker when i want to select/or edit a date:
    img2.JPG

    3. I selected the date but after I edit it it doesn't display it correctly:
    img3.JPG

    It is saving the correct date informations in the data base and display it correctly the next time you load it.

    Any suggestions ?

  9. #9
    Sencha User issameddine's Avatar
    Join Date
    Apr 2008
    Location
    Tunisia
    Posts
    126
    Vote Rating
    1
    issameddine is on a distinguished road

      0  

    Default


    hello
    why you multiplied the value of the date by 1000 (value * 1000)?
    I tested your code and everything works

  10. #10
    Ext User
    Join Date
    Mar 2010
    Posts
    23
    Vote Rating
    0
    DominateQ is on a distinguished road

      0  

    Default


    If i don't multiplied by 1000 i don't get the date correctly.

    img4.JPG
    I really don't know what to do and where to check what is wrong.

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