Results 1 to 2 of 2

Thread: Grid custom renderer selected cell value

  1. #1

    Default Grid custom renderer selected cell value

    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

    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.


    Code:
     
     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+' target="_parent">'+ value +'</a>';
                     }//end renderer
    
                        },
                    {header: "Address", width: 75, sortable: true, dataIndex: 'Address'}
                ],
                stripeRows: true,
                autoExpandColumn: 'ID',
                height:350,
                width:600,
                title:'Array Grid'
            });

  2. #2
    Sencha User
    Join Date
    Apr 2008
    Location
    Hong Kong
    Posts
    171

    Default

    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' event of GridPanel to achieve the same.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •