1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    62
    Vote Rating
    0
    sendy is on a distinguished road

      0  

    Default Unanswered: Ext.picker.Date getValue() Null

    Unanswered: Ext.picker.Date getValue() Null


    Hy I am using the plugin Slider-Menu with navigation view
    I have this view:
    Ext.define('UnivMobile.view.AddEvent', {
    extend: 'Ext.Panel',
    requires: ['Ext.picker.Date'],

    xtype: 'option2card',


    config:{
    title: 'Add Event'
    },

    config: {
    fullscreen: true,
    title: 'Add Event',
    name:'p',
    items: [ {
    xtype: 'fieldset',
    items: [
    {
    xtype: 'textfield',
    name: 'nomEvent',
    id:'nomevent',
    label: 'Nom Event:'

    },
    {
    xtype: 'textfield',
    name: 'dateDebEvent',
    id:'debEvent',
    label: 'Date de debut Event:',
    value:new Date,
    listeners : {
    focus:function( ) {
    var datePicker= Ext.create(Ext.picker.Date, {
    dateFormat:'Y-m-d',
    id:'picker1',
    doneButton:{
    listeners:{
    tap:function (button, event, eOpts) {
    console.log('inside done button'); //It works
    console.log(Ext.getCmp('picker1').getValue());// It doesn't work (null)
    console.log('done button');// It works
    }
    }
    }
    });
    this.parent.parent.parent.parent.push(datePicker);


    }
    }


    },
    {
    xtype: 'textfield',
    name: 'dateFinEvent',
    id:'finEvent',
    label: 'Date de fin Event:'
    },
    {
    xtype: 'textfield',
    name: 'lieu',
    id:'loc',
    label: 'Lieu:',

    }
    ] // items
    },





    {
    xtype: 'toolbar',
    layout: {
    pack: 'center'
    }, // layout
    ui: 'plain',
    items: [
    {
    xtype: 'button',
    text: 'Reset',
    id:'resetb',
    ui: 'decline',
    listeners: {
    tap: function(){
    this.parent.parent.parent.parent.push(Ext.Msg.confirm('', 'Are you sure you want to reset this form?', function (btn) {
    switch (btn) {
    case 'yes':
    var valueNom=Ext.getCmp('nomevent');
    valueNom.setValue('');

    break;
    default:
    break;
    } // switch
    })
    );
    }
    }
    },

    {xtype: 'button',
    text: 'Submit',
    ui: 'confirm',
    listeners: {
    tap: function(){



    this.parent.parent.parent.parent.push(Ext.Msg.alert('rr'));
    }
    }
    }
    ] // items (toolbar)
    }
    ]

    }



    });
    I got the datePicker but when I click on done button.The value of datePicker is null
    Please any help???

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    34,117
    Vote Rating
    453
    Answers
    3160
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    First, couple issues

    When you post code, wrap your code in BBCode CODE tags.

    You have two config objects, the last one will be used, all others will not be used.

    this.parent.parent.parent.parent.push(...); this is very bad. You need to use ComponentQuery to better resolve things. this.up('formpanel') for example will go from a component and resolve a parent that is a formpanel.

    The push method is used on a navigation view only but I don't see a navigation view component being used.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    62
    Vote Rating
    0
    sendy is on a distinguished road

      0  

    Default


    Hy,
    The first config is commented I am using just one.
    And I have a method push because I am using navigation view (plugin Slider menu).
    The problem of getValue from picker is found :
    here is the solution:
    change : function(datePicker1, value) {
    console.log(value);
    var valueDateDeb=Ext.getCmp('debEvent');
    valueDateDeb.setValue(value);

    }