PDA

View Full Version : Assigning a href link to a property grid tag in extjs



thangamalar
7 Sep 2010, 10:00 PM
Hi,

I want to assign a html href link to a property grid tag in my project. Please find the sample code below and it always shows the value like "<a href="javascript:void(null)">1</a>" instead of 1. How do I overcome this?

I marked the place where I am assigning the link in RED color below.



listeners: {
load: function(store, records, option) {
var datas = {};
var o = null;
for (var i = 0; i < records.length; i++) {
o = records[i].data;
datas[o.tag] = o.content;
}
propertyHvGrid.setSource(datas);

var vmCount = propertyHvGrid.getStore().getById('vmCount').get('value');
alert ("Vm Count ====="+ vmCount);
if (vmCount > 0) {
propertyHvGrid.setProperty('vmCount', '<a href="javascript:void(null)">'+vmCount+'</a>')
}

}
}
});

Condor
7 Sep 2010, 11:54 PM
You will need to configure a vmCount renderer in customRenderers, because the default renderer htmlEncodes the value.

thangamalar
8 Sep 2010, 12:53 AM
Custome renderer for the columnModel will work. How do we return a property value in this case?

Condor
8 Sep 2010, 1:11 AM
customRenderers: {
vmCount: function(v){
return v;
}
}

thangamalar
8 Sep 2010, 1:28 AM
oh my god.... got it now. It works fine.

thangamalar
8 Sep 2010, 1:30 AM
How do I close this thread?