0
votes

I am using a grid panel in which I need to make a column as a link(It should look like link-with no action). I am using listener in the gridpanel and on click of a cell its working fine. Only thing is 1st column should look like a link. But how to put href="#" I am not sure. This is my code:

var addressDetailsStore = Ext.create('Ext.data.Store', {
    id:'addressDetailsStore',
    autoLoad: true,
    fields:
    [
    'addressType', 
    'street1', 
    'street2', 
    'province', 
    'city', 
    'country' 
    ], 
    proxy: {
        type: 'ajax',
        url: 'resources/json/addressDetails.json',  // url that will load data with respect to start and limit params    
        reader: {
            type: 'json',
            root: 'items',
        }
    }


});

Ext.define('iOMS.view.common.addressView', {
extend: 'Ext.grid.Panel',
alias: 'widget.AddressViewPanel',
    layout: 'fit',
    collapsible: true,
    title:'Address',

    store: addressDetailsStore,
    listeners:{
                cellclick:function (iView, iCellEl, iColIdx, iRecord, iRowEl, iRowIdx, iEvent){
// Getting the event and I am doing logic here..

}

I just want 'addressType' columns appear like a link and I dont know where to put href... Thanks for your responses. -Praveen

3

3 Answers

5
votes

You could also use a template column:

columns: [
    { text: 'External Link', xtype: 'templatecolumn', tpl: '<a href="{url}">{title}</a>'}
]
3
votes

You can specify the columns you want, and for the column with just a link, add a renderer. This example might help you.

var template = new Ext.XTemplate(
        '<a href="#"> </a>').compile();

columns:[
            {
                header: "",
                renderer: function () {
                    return template.applyTemplate();
                }
            },
0
votes

You can use renderer function like as follow

columns: [
        {
            header: 'number',
            dataIndex: 'number',
            flex: 1,
            renderer: function(number) {
                return Ext.String.format('<a href="#users/{0}">{0}</a>', number);
            }
        },