Hybrid View

  1. #1
    Touch Premium Member
    Join Date
    Aug 2008
    Posts
    84
    Vote Rating
    2
    dmillasich is on a distinguished road

      0  

    Default Toolbar button anchor link

    Toolbar button anchor link


    I'm fairly new to the Sencha Touch API. I'm trying to do something that it's fairly easily accomplished in other Javascript APIs such as JQuery and Mootools, but I'm struggling to get this issue worked out.

    I have a panel with several elements, one of which is a bit of text combined with an anchor link, for example:

    Code:
    var myPanel = new Ext.Panel({
        id: 'my-panel',
        dock: 'top',
        cls: 'my-panel',
        dockedItems: [{
                id: 'my-link',
                cls: 'my-link',
                dock: 'top',
                html: '<a href="http://www.google.com'">Google</a>'
            }]
    });
    I would like to have the functional equivalent of the anchor link attached to a button on a toolbar. In theory, something like this:

    Code:
    var myToolbar = new Ext.Toolbar({
         dock: 'top',
         items: [{
                iconCls: 'my-toolbar',
                text: 'Google!',
                html: '<a href="http://www.google.com">Google</a>'
            }]
    });
    It seems likely to me that there would be a way of navigating away from my Sencha Touch app to an external url specified by a link on a toolbar button.

    Thanks in advance for any ideas.

  2. #2
    Sencha Premium Member crysfel's Avatar
    Join Date
    Feb 2008
    Location
    New York, USA
    Posts
    218
    Vote Rating
    8
    crysfel will become famous soon enough

      0  

    Default


    How about this:

    Code:
    var myToolbar = new Ext.Toolbar({
         dock: 'top',
         items: [{
                iconCls: 'my-toolbar',
                text: 'Google!',
                handler : function(){
                   document.location = "http://www.google.com";
                }
            }]
    });
    Good luck

  3. #3
    Touch Premium Member
    Join Date
    Aug 2008
    Posts
    84
    Vote Rating
    2
    dmillasich is on a distinguished road

      0  

    Default


    Hello crysfel -

    ...actually - sort of.

    Some things about my app complicate the provided solution:
    1. The app is actually linking to a netflix.com url.
    2. The app is meant to be run from an iPad.
    3. The app is instantiated from an icon on the iPad "home screen".

    This works just fine as long as the app is not started from the "home screen".

    If I run the application by going to it in Safari - the "document.location = "http://www.netflix.com/WiPlayer?movieid=123456789" solution works. From the "home screen" however, I get a funky error message from the target server. The target url renders up to a point - then presents an alert message that it "Cannot open [home screen icon name here]".

    These are all details I should have provided in the beginning. Sorry about that. It was well before my daily allotment of coffee.

  4. #4
    Sencha User
    Join Date
    May 2012
    Posts
    13
    Vote Rating
    0
    Ashulove is on a distinguished road

      0  

    Default add link button

    add link button


    how to add link button in grid column.

  5. #5
    Sencha User
    Join Date
    Jul 2014
    Posts
    2
    Vote Rating
    0
    mer34 is on a distinguished road

      0  

    Default


    thaks

Similar Threads

  1. Link Button or Hyper link
    By nikhilwalker in forum Ext 2.x: Help & Discussion
    Replies: 69
    Last Post: 24 May 2013, 5:13 AM
  2. No xtype for a link (anchor)?
    By alphadogg in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 25 Nov 2010, 9:19 AM
  3. There's no xtype for a link (anchor)?!?
    By alphadogg in forum Sencha Touch 1.x: Discussion
    Replies: 1
    Last Post: 12 Nov 2010, 5:25 AM
  4. Anchor textfield in toolbar
    By Adversus in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 27 Aug 2008, 8:40 AM
  5. TabPanel activate IE7 error --- Anchor name link FF2 scrolls whole page
    By millenovecento in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 31 Jul 2008, 5:37 PM

Thread Participants: 3