Results 1 to 10 of 10

Thread: How to change href property of button's component ?

  1. #1

    Default How to change href property of button's component ?

    Latest ExtJS (4.1.2)
    How to change href property of button's component ? I was no found setHref method in the API doc's.

  2. #2
    Sencha User loiane's Avatar
    Join Date
    Aug 2009
    Posts
    191
    Answers
    9

    Default

    You can change it directly like this:

    Code:
    buttonInstance.href = 'new value';
    Sencha/Java evangelist
    Author of ExtJS 4 First Look and Mastering Ext JS books
    English blog: http://loianegroner.com
    Portuguese blog: http://loiane.com
    Sencha Examples: https://github.com/loiane

  3. #3
    Sencha User
    Join Date
    Sep 2010
    Posts
    27
    Answers
    2

    Default

    Quote Originally Posted by loiane View Post
    You can change it directly like this:
    Code:
    buttonInstance.href = 'new value';
    This will not change realy href property in <a...> tag in DOM, only href in ExtJS object...
    I have the same problem: http://www.sencha.com/forum/showthread.php?245393-Button-drop-down-menu-and-href&p=897072#post897072

    T
    he solution is to set id property in the button object and update DOM like this:

    Code:
    Ext.getDom('e_tif-itemEl').href = 'http://..........'
    Dirty way, but the other did not find...

  4. #4
    Ext JS Premium Member
    Join Date
    Nov 2009
    Location
    St Louis,MO
    Posts
    267
    Answers
    20

    Default

    What they said.

  5. #5

    Default

    I do not need a DOM.
    I need to dinamically change href property of ExtJS button: add some GET parameters, that will be sent to server.
    The question is: how ?
    If I change like this:

    Code:
     Ext.getCmp('mybutton').href = 'http://extjstest/test.php?par1=1&par2=2';
    it will change this property in DOM only once, the next use will not change and button work incorrectly (sends old parameter's values).

  6. #6

    Default

    Hey guys, did anyone come across? Property of a button to change depending on the specific actions - frequent situation.
    In JQuery classes and DOM are fully synchronized...

  7. #7
    Sencha User
    Join Date
    Sep 2011
    Posts
    574
    Answers
    59

    Default

    Try changing href property of button component instance and then invoke http://docs.sencha.com/ext-js/4-1/#!...thod-setParams

  8. #8
    Sencha Premium Member bizsysdev3's Avatar
    Join Date
    Aug 2012
    Posts
    12

    Default

    this worked for me (using v4.2.1):
    Code:
    button.href = '#new_link';
    button.el.dom.href = button.getHref();

  9. #9
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258
    Answers
    759

    Default

    4.2.x has a setHref method.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  10. #10
    Sencha Premium Member bizsysdev3's Avatar
    Join Date
    Aug 2012
    Posts
    12

    Default

    ah! Thanks, that works. The contents of the function actually are *exactly the same* what I just posted above, too.

    Note that you MUST set the 'href' property (to anything) when defining the component in order for the 'setHref()' method to work.

Posting Permissions

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