PDA

View Full Version : Sliding Pager link in column



teddy11
23 Mar 2012, 10:54 AM
I am using the Sliding Pager grid and want to turn one column into links. Bascially, there are about ten items repeated many many times and what I want to do is, when you click on each item a new page to open up.


// register model
Ext.define('TEST', {
extend: 'Ext.data.Model',
idProperty: 'company',
fields: [
{name: 'company'},
{name: 'category', type: 'text'},
{name: 'something', type: 'text'},
{name: 'something', type: 'number'},
{name: 'something', type: 'text'},
{name: 'something', type: 'text'},
{name:'first', url:'http://cnn.com'}..........
------------------------------------------------------------
// create the Grid
var grid = Ext.createWidget('gridpanel', {
title:'TEST',
store: store,
columns: [{
id:'company',
text: 'Company',
sortable: true,
dataIndex: 'company',
flex: 1,
width: 130,
renderer: function (val, meta, record) {
return '<a href="' + record.data.Link + '">' + val + '</a>';
}
}

The items in the columns turn into a hyperlink. I get undefined error when I click on the link.
What am I doing wrong? What is the proper way of declaring the site? Is there anything else I am missing.
Thanks.

mitchellsimoens
23 Mar 2012, 12:24 PM
Are you capturing the anchor tag click?

teddy11
23 Mar 2012, 12:51 PM
I can't find any info on the "anchor tag" in the API or in this forum that is useful.
I have no clue how to use it. I am assuming company would be my anchor tag (if it means my "main" column) and I have tried adding it like so
return '<a href="' + company+ '">' + val + '</a>';and this does not work. Can someone please provide an example as I dont see any documentation on this topic?

teddy11
23 Mar 2012, 1:39 PM
Update:
I know the record.data.company will give me the comany id but when I use first which is the url's id, it does not work. What is the correct way of assigning the url in the definining model stage?