OldNurse
OldNurse

Reputation: 153

Sencha Touch 2 - Text Overlapping Issue

I'm a new developer in Sencha Touch 2 and I'm trying to create my first application using its provided MVC architecture. I find issues with toolbar/titlebar text overlapping when navigating between pages. Take a look at these screenshots:

Example 1

Example 2

I'm not pretty sure what's happening out there. I am using animateActiveItem and routing method to move across my application.

Users.js controller file, login method

// Ajax code here, not included here
// on ajax success:
this.redirectTo("login");

Routes.js controller file

routeLoginPage: function() {
    console.log("routeLoginPage");
    Ext.Viewport.animateActiveItem({ xtype: "loginpage" }, { type: "slide", direction: "left" });
},

Has anybody really faced a problem like this? I have no idea what to do right now as I was trying to resolve this issue for 2 days+.

EDIT

Basically I need to move across the pages defined as views. I define each view in different file containing properties: extend, requires, alias, config and methods defined by me. Every config property has titlebar attached as its first item.

When I'm trying to change page, I load another view by controller command which changes address hash. Routes controller then fires an animateActiveItem method which loads another View (defined previously as xtype by alias property).

I was using Miami Coder's Tutorial (miamicoder.com/2012/how-to-create-a-sencha-touch-2-app-part-1/) to learn Sencha Touch basics.

Upvotes: 1

Views: 818

Answers (3)

Ram G Athreya
Ram G Athreya

Reputation: 4952

{
    xtype: 'navigationview',
    id: 'navView',
    navigationBar: {
        hidden: true
    }

}

The above code will hide the title bar generated by navigation view... Now you need to define your own titlebar like so

{
       xtype: 'titlebar',
       title: 'title',
       items: [
            {
                   xtype: 'button',
                   text: 'back',
                   listeners: [
                     {
                         fn: function(button){
                              Ext.getCmp('navView').pop();//this will pop the view and show previous view
                         },event: 'tap'

                     }
                   ]
            }
       ]



}

Hope it helps...

Upvotes: 0

amrit_neo
amrit_neo

Reputation: 1759

You can add your required views in one panel class and enable the required view using

mainclass.setActiveItem(0)

or else use the navigation view

Upvotes: 0

Ram G Athreya
Ram G Athreya

Reputation: 4952

I think you mean title bar and not toolbar...

Use navigation view to navigate between views instead of Ext.Viewport.animateActiveItem It is a better method. For using navigation view use this guide in sencha docs... Sencha has a steep learning curve so be ready for frustrations like this...

Navigation View Guide

Upvotes: 1

Related Questions