1. #1
    Ext User
    Join Date
    Jan 2010
    Posts
    2
    Vote Rating
    0
    ajmott is on a distinguished road

      0  

    Default ListView and column template

    ListView and column template


    I'm an ExtJS newbie (though I've been using GWT-Ext for quite some time in an enterprise environment) and am struggling a little. I'm trying to add a simple template to the list-view.js in /ext-3.1.0/examples/view. The template is simply to make the text of one of the columns of data into a link. The template is applied, and the text is indeed turned into a link. However, when I click the link, nothing happens. Using firebug I've verified that the HTML looks correct for the rendered link. Is there any kind of listener/handler that I should have also attached? The following is the change that I made to the list-view.js file (the tpl property was simply added to the first colum "File"):

    Code:
    tpl: new Ext.XTemplate('{name:this.getLink}',{
      getLink : function(val,record) {
        return String.format('<a href="http://www.google.com/{1}" target="_blank">{0}</a>', val,record.url);
      }
    })
    If I've simply missed something in the documentation, a gentle pointer would be appreciated. (Or if the defect is more glaring, flog away.)

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    8,883
    Vote Rating
    102
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    This is a feature of the Ext.DataView (the parent class of Ext.ListView). Whenever you click on an item it will prevent the default action from occurring. You could do something like so....

    Code:
    listView.on('click', function(dv, idx, n, e) {
    	var anchor = e.getTarget('a');
    	window.open(anchor.href);
    });
    Or perform even more complex actions by pulling out additional information from the underlying Ext.data.Record.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  3. #3
    Ext User
    Join Date
    Jan 2010
    Posts
    2
    Vote Rating
    0
    ajmott is on a distinguished road

      0  

    Default


    Ah - that makes sense then. I had gotten it to work by adding my own onclick event to the anchor tag manually in the template, but I figured there had to be a "proper" way to do it via pre-existing handlers. Thanks for the help, Aaron!

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar