View Full Version : Grid custom renderer selected cell value

25 Aug 2009, 4:09 AM
Good afternoon ladies and gents,

Is it possible to access the selected row's value from within the custom renderer

for example in the following code

i would like to send an http request if a user clicks on the cell http://localhost:8080/test/testservlet?attribute=page1&id="'+record (http://localhost:8080/test/testservlet?attribute=page1&id="'+record)

the value of record isn't being replaced, I tried store.getAt(1) as well didn't know

Wonder if any one can shed some light thanks.

var grid = new Ext.grid.GridPanel({
store: store,
columns: [
{id:'ID',header: "ID", width: 160, sortable: true, dataIndex: 'ID'},
{header: "Name", width: 75, sortable: true, dataIndex: 'Name',

renderer: function(value, metaData, record, rowIndex, colIndex, store) {
//The <a> tag is used to create an anchor to link from
//the href attribute is used to address the document to link to
//the words between the open and close of the anchor tag will
//be displayed as a hyperlink (value).
//the target attribute defines where the linked document will
//be opened (_blank = open the document in a new browser window)
return '<a href="http://localhost:8080/test/testservlet?attribute=page1&id="'+record+' (http://localhost:8080/test/testservlet?attribute=page1&id=&quot;'+record+') target="_parent">'+ value +'</a>';
}//end renderer

{header: "Address", width: 75, sortable: true, dataIndex: 'Address'}
stripeRows: true,
autoExpandColumn: 'ID',
title:'Array Grid'

25 Aug 2009, 6:02 AM
the 'record' is Ext.data.Record so you can use record.get(xxx) or record.data.xxx to retrieve the data.
or you can use 'cellclick (http://extjs.com/deploy/dev/docs/?class=Ext.grid.GridPanel&member=cellclick)' event of GridPanel to achieve the same.