1. #1
    Sencha Premium Member
    Join Date
    Sep 2010
    Posts
    89
    Vote Rating
    0
    xun is an unknown quantity at this point

      0  

    Default Unanswered: Ext link button?

    Unanswered: Ext link button?


    hi, is it possible to have a button that essentially just a html link with all the events, but none of of button rendering?

    <a href="javascript:void(0);" onclick="this.blur(); return false;" class="{cls}"{tabindex}><span>{text}</span></a>

    Currently we made a custom component (in ext 3) that we basically add various event to the above html string, which i think is overkill.

    But the ext button right now will always give you a tone of button classes (for example:
    class="css3-button primary css3-button-default-small x-noicon css3-button-noicon css3-button-default-small-noicon"), which made it very hard to style, especially we are trying to migrate. I do not want to have to restyle all of my css elements.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,604
    Answers
    3449
    Vote Rating
    818
    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

      1  

    Default


    Just typing off the top of my head:

    Code:
    Ext.define('Ux.LinkButton', {
        extend : 'Ext.Component',
        xtype  : 'linkbutton',
    
        text    : null,
        handler : Ext.emptyFn,
    
        initComponent : function() {
            var me = this;
    
            me.html = '<a>' + me.text + '</a>';
    
            me.callParent();
        },
    
        afterRender : function() {
            var me = this;
    
            me.callParent(arguments);
    
            me.mon(me.el, {
                scope    : me,
                delegate : 'a',
                click    : me.handleClick
            });
        },
    
        handleClick : function(e) {
            e.stopEvent();
    
            this.handler.call(this, this);
        },
    
        setText : function(text) {
            this.update('<a>' + text + '</a>');
        }
    });
    
    new Ux.LinkButton({
        renderTo : document.body,
        text     : 'Test',
        handler  : function(btn) {
            console.log(btn);
        }
    });
    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 Premium Member
    Join Date
    Sep 2010
    Posts
    89
    Vote Rating
    0
    xun is an unknown quantity at this point

      0  

    Default


    this is essentially what we are doing. But I thought there was a better way in ext 4. So for anything that is a bit of customized, we have to resort to the old Component.

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,604
    Answers
    3449
    Vote Rating
    818
    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


    You can change the renderTpl but I find this is the easiest.
    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.

  5. #5
    Sencha User
    Join Date
    Sep 2008
    Posts
    16
    Vote Rating
    0
    la_ka is on a distinguished road

      0  

    Default Really simple sulotion, thanks

    Really simple sulotion, thanks



Thread Participants: 2