1. #1
    Sencha User
    Join Date
    Aug 2012
    Location
    Pune, India
    Posts
    78
    Answers
    5
    Vote Rating
    0
    Pravin.Pawar is on a distinguished road

      0  

    Default Unanswered: Hyperlink to displayfield

    Unanswered: Hyperlink to displayfield


    Hi,

    I have used displayfield in ExtJS to show read only values and wanted to provide hyper link so that user can navigate to other page.

    Please let me know how to enable hyperlink and attach url link.

    Thanks, Pravin
    Thanks, Pravin

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

      0  

    Default


    use render listener to call a method and from the method return link as below:

    function getLinkRenderer(value, obj, record) {
    return '<a href ="javascript: jascriptMethod()">' + value + '</a>';
    }

  3. #3
    Sencha User existdissolve's Avatar
    Join Date
    Jan 2010
    Location
    Kansas
    Posts
    522
    Answers
    31
    Vote Rating
    85
    existdissolve is just really nice existdissolve is just really nice existdissolve is just really nice existdissolve is just really nice existdissolve is just really nice

      0  

    Default


    Try using autoEl:

    PHP Code:
    {            
        
    xtype'displayfield',            
        
    value'Google',            
        
    autoEl: {               
            
    tag'a',                
            
    href'http://google.com',                
            
    target:'_blank'            
        
    }        


  4. #4
    Sencha User
    Join Date
    Aug 2012
    Location
    Pune, India
    Posts
    78
    Answers
    5
    Vote Rating
    0
    Pravin.Pawar is on a distinguished road

      0  

    Default


    This is NOT working over ExtJS form... can i use any other way?
    Thanks, Pravin

  5. #5
    Sencha User existdissolve's Avatar
    Join Date
    Jan 2010
    Location
    Kansas
    Posts
    522
    Answers
    31
    Vote Rating
    85
    existdissolve is just really nice existdissolve is just really nice existdissolve is just really nice existdissolve is just really nice existdissolve is just really nice

      0  

    Default


    Which is not working? Can you post your code?

  6. #6
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Answers
    124
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default


    Hi,

    Try the following code-

    Code:
    {            
        xtype: 'displayfield',            
        value: '<a href ="www.google.com">Google</a>'
    } 
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  7. #7
    Sencha User
    Join Date
    Aug 2012
    Location
    Pune, India
    Posts
    78
    Answers
    5
    Vote Rating
    0
    Pravin.Pawar is on a distinguished road

      0  

    Default


    your code works somehow NOT sure how to open URL in new window. I coded like -

    {
    xtype: 'box',
    autoEl: {
    tag: 'a',
    href: 'http://www.google.com/',
    cn: 'Google'
    },
    listeners: {
    render: function (c) {
    c.on('click', function (e) {
    alert('You clicked me!');
    }, c, { stopEvent: true });
    }
    }
    }

    Above code also open URL in the same window. Please let me know how can I open URL in new window.
    Thanks, Pravin

  8. #8
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Answers
    124
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default


    Try the below code-

    Code:
    {
          xtype: 'box',
          autoEl: {
          tag: 'a',
          href: 'http://www.google.com/',
          target: '_blank'   //  for open in new window
          cn: 'Google'
    },
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  9. #9
    Sencha User
    Join Date
    Aug 2012
    Location
    Pune, India
    Posts
    78
    Answers
    5
    Vote Rating
    0
    Pravin.Pawar is on a distinguished road

      0  

    Default


    Thanks... target='_blank' was missed out in my code and it works fine now.

    I have dashboard where the list is displayed and on row click I'm opening form dialog window where I need to set display values with hyperlink which will navigate to respective record from other app.

    Now the issues is when I'm opening dialog window first time; my code owrks fine... somehow next time hyperlinks displays old values... i mean the values of first time window load.

    Please let me know how should I clear old values from the hyperlink and repalce with new values.. Im using following code which works fine for first time window load-

    var lastIncidentNo = Ext.getCmp('lastincidentnoid');
    lastIncidentNo.autoEl.cn = results.IncidentNo;
    lastIncidentNo.autoEl.href = 'http://Google.com/' + results.IncidentNo;
    Thanks, Pravin