1. #1
    Sencha User
    Join Date
    Jan 2013
    Posts
    5
    Vote Rating
    0
    elcrian is on a distinguished road

      0  

    Default Unanswered: 2 questions concerning controller & bug in titlebar + IDE?

    Unanswered: 2 questions concerning controller & bug in titlebar + IDE?


    Hello,
    first of, I'm sorta new to Sencha and am currently trying to setup a test-project. Very basic, just a functionality to add and view entries from the local storage and maybe send it to a server afterwards. Pretty much just to learn the basic functions.

    My first issue is very simple: The icons / links in the titlebar won't show up.
    Code:
    Ext.define('TestSencha.view.Main', {    
    extend: 'Ext.tab.Panel',
        xtype: 'main',
        requires: ['Ext.TitleBar'],
        config: {
            fullscreen: true,
            tabBarPosition: 'bottom',
    
    
                items: [
                   {
                        docked: 'top',
                        xtype: 'titlebar',
                        title: 'Welcome to Sencha Touch 2'
                    },
                    {
                        iconCls: 'add',
                        title: 'Add',
                        xtype: 'AddEntry'
                    },
                    {
                        iconCls: 'time',
                        title: 'View',
                        xtype: 'ViewEntries',
                    }
                ]
        }
    });
    It starts off by showing me the "Welcome to Sencha Touch 2" screen and the AddEntry-view.

    Second issue I'm facing is that my controller doesn't recognize references via ID (as described in the tutorials):
    Code:
    Ext.define('TestSencha.model.Day', {     
    extend: 'Ext.data.Model',
        requires: ['Ext.data.Store'],
        id: 'DayModel', // there we go
        config: {
            fields: [
                { name: 'id', type: 'int'},
                { name: 'weekNo', convert: function(){
                    var date = new Date();
                    return Ext.Date.format(date, 'W'); // i wanna call a function like "getDate()" from my controller from here
                }},
    // ...
    Code:
    Ext.define('TestSencha.controller.AddEntry', {    
    extend: 'Ext.app.Controller',
        requires: ['TestSencha.model.Day'],
        config: {
            stores : ['Days'],
            models : ['Day'],
            refs: { // reference the classes that will use this controller
                dayView    : '#DayView'
            },
            control : { // use handler-mechanics for every button with the action "addEntryAction"
                'container button[action=addEntryAction]' : {
                     tap : 'addEntry' // that one works
                 },
                 'DayModel': {
                     activate : 'onActivate' // that one doesn't and futhermore, the function's name isn't recognized from within the model
                 },
            }
        },
    
        // [...]
    
        onActivate : function(){ // debug mucho
            console.log('Controller for view is active!')
        },
            
       // http://docs.sencha.com/touch/2-0/#!/api/Ext.Date
       getAndConvertTime: function(args) { 
           console.log('Test getAndConvertTime()');
        var date = new Date();
        if (args = 'WEEK') return Ext.Date.format(date, 'W');
        else if (args = 'WEEKDAY') return Ext.Date.format(date, 'D');
        else if (args = 'TIME_AMERICAN') return Ext.Date.format(date, 'g:i a');
        else if (args = 'TIME_EUROPEAN') return Ext.Date.format(date, 'G:i');
        else if (args = 'DATE_AMERICAN') return Ext.Date.format(date, 'n/d/y');
        else if (args = 'DATE_EUROPEAN') return Ext.Date.format(date, 'd.n.y');  
       }
    });
    My third and last question would be: Is there any convenient, free IDE available for Sencha? I'm currently using Aptana, but unfortunately there seems to be no way to enable an auto-completion or an integrated complier which tells you about your errors before you load it into the browser.

    Thanks in advance!

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,798
    Answers
    3467
    Vote Rating
    834
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    For the icons, did you create the needed icons?

    For the id issue on the model, the control config in a controller will only work with components, a model is not a component so this will never work. For you convert method, I'd suggest creating a utility singleton that you can call from the convert method on that field.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

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

  3. #3
    Sencha User
    Join Date
    Jan 2013
    Posts
    5
    Vote Rating
    0
    elcrian is on a distinguished road

      0  

    Default


    Hi,
    thanks for your response. I didn't create the icons (and am not sure if I'd know how to do so); however, the buttons still don't appear even if I try to use the "title" property only:
    Code:
    {         //iconCls: 'add',
                        title: 'Add',
                        xtype: 'AddEntry'
                    }
    ...which totally confuses me.

    Concerning the controller: Okay, I wasn't aware of that. I'm gonna try using a class with the singleton-property for that.

Thread Participants: 1

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