Results 1 to 5 of 5

Thread: label and controller

  1. #1
    Sencha User
    Join Date
    Oct 2016
    Posts
    52
    Answers
    1

    Default label and controller

    Hello everybody, one probleme where i use xtype:label
    Not Work
    Code:
    {xtype: 'label',
    id:'DateJour1',
    region:'center',
    renderTo: Ext.getBody(),
    listeners: {
    'render':'OnDateJourJ'
    }
    Work
    Code:
    Ext.define('workspace.view.accueil.ViewBodyController', {
    extend: 'Ext.app.ViewController',
    alias: 'controller.ViewBodyController',
    Controller
    Code:
    OnDateJourJ:function(panel) {
    var dateJour = new Date();
    var j = new Array( "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche" );
    var m = new Array( "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Aout", "Septembre", "Octobre", "Novembre", "Décembre" );
    var date = j[dateJour.getDay() - 1];
    Ext.getCmp('DateJour1').setText(date).addCls('paneldate')
    },

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379
    Answers
    3997

    Default

    Your label is configured to be rendered to the body, is that right? Also, is the label within a container of some sort that is bound to the ViewController that has the OnDateJourJ method?
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  3. #3
    Sencha User
    Join Date
    Oct 2016
    Posts
    52
    Answers
    1

    Default

    yes it's true how to make the rendering? thank you

  4. #4
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379
    Answers
    3997

    Default

    First, since your label is a child item of a parent container, remove the renderTo. I'm not sure why you would think that would work.

    Also, I think you need to slow down so you can grok what's going on with things. The render listener fires with the reference to the component firing it meaning the first argument of OnDateJourJ is the label. I'm saying this because you can now remove the id and replace the Ext.getCmp('DateJour1') with the first argument. You have it as panel but it's the label that is firing it.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  5. #5
    Sencha User
    Join Date
    Oct 2016
    Posts
    52
    Answers
    1

    Default

    Ok thank you very match

Similar Threads

  1. Replies: 6
    Last Post: 10 Feb 2014, 2:59 PM
  2. Replies: 2
    Last Post: 1 Nov 2013, 9:31 AM
  3. How to change the label value which is inside a controller??
    By arindam.hit in forum Sencha Touch 2.x: Q&A
    Replies: 1
    Last Post: 21 Jan 2013, 12:28 PM
  4. How to move label action to controller
    By ssurajita111 in forum Ext: Q&A
    Replies: 1
    Last Post: 21 Oct 2012, 5:59 PM
  5. How to bind data to label at controller level
    By Rameshlamani in forum Sencha Touch 2.x: Q&A
    Replies: 2
    Last Post: 30 May 2012, 9:38 PM

Posting Permissions

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