Results 1 to 3 of 3

Thread: Ext.picker.Date getValue() Null

  1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    62
    Vote Rating
    0
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3932
    Vote Rating
    1272
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

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

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    62
    Vote Rating
    0
      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);

    }

Posting Permissions

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