Custom Link in Grid Column

Topics: Platform, UI Framework
Jul 29, 2010 at 12:29 PM

Dear All,

 

I try to render a grid column with custom link such that when it is clicked it pass selected row id.

I wrote following code but it does not render the Link but it display ID in column. Can anyone please advise.

 

        <Field HeaderText="test" FieldName="Id">
            <Transform-VariableString Value="&lt;a href='/Temp.aspx?refID=$Id$'&gt; test &lt;/a&gt;"/>
        </Field>

 

Regards,

 

Coordinator
Aug 19, 2010 at 4:34 PM

You can configure a ExtJs-Renderer element into a field for Custom Link. The content of the element should be a JS function with the following parameters,
# value : Object, the data value for the cell.
# metadata : Object, an object in which you may set the following attributes:
    * css : String, A CSS class name to add to the cell's TD element.
    * attr : String, An HTML attribute definition string to apply to the data container element within the table cell (e.g. 'style=&quot;color:red;&quot;').
# record : Ext.data.record, The Ext.data.Record from which the data was extracted.
# rowIndex : Number, Row index
# colIndex : Number, Column index
# store : Ext.data.Store, The Ext.data.Store object from which the Record was extracted.

An example looks like,

function(value, metadata, record, rowIndex, colIndex, store)
{
    if (value == 'whatever') { return 'something'; }
    return 'nothing';
}