PDA

View Full Version : The link Embedded in the treegrid column doesn't work



jzhang1
22 Apr 2011, 7:31 AM
This is the code I have. When I clicked the link on column Detail, It doesn't do anything. Please help.
I am very new to extjs. Thanks!

var tree = new Ext.ux.tree.TreeGrid({
title: 'APS Budget Proposals',
width: 980,
height: 300,
renderTo: Ext.getBody(),
enableDD: true,
columns:[{
header: 'Rev ID',
dataIndex: 'rev_id',
width: 260
},{
header : "Detail",
dataIndex: 'rev_id',
width : 100,
hideable : false,
tpl: new Ext.XTemplate('{rev_id:this.display}', {
display: function(v) {
return '<a href="../detail.html?rev_id='+v+'" class="button-info"><img src="/gen-doc/bpsnew/img/shared/information.png" /></a>';
}
})
}
],

dataUrl: 'treegrid-data.json'
});

httpdotcom
22 Apr 2011, 8:32 AM
A grid cell is a wrapper around the data itself. When you click on the cell, you aren't actually clicking on the data, per se.

If this were a regular grid (and not a treegrid), I would suggest using the grid's CellSelectionModel and creating a listener using "cellselect". Perhaps that could be adapted for this component.
http://dev.sencha.com/deploy/dev/docs/source/CellSelectionModel.html#event-Ext.grid.CellSelectionModel-cellselect