0
我有一個列的網格面板,如果你點擊你下載一個文件關聯到這一行。 在ExtJS的2我只是定義了一個新的渲染這是一個函數返回誰只有這樣返回一個URL的字符串格式:下載文件的行點擊,在extjs4
function DownaloadFile(value, metadata, record, rowIndex, colIndex, store)
if (record.data.id){
return String.format('<b><a href="<c:url value='/fileDownload.action?id={0}'/>" title="<fmt:message key='button.table.file.download.tooltip'/>"><img src="<c:url value="/icons/icon_download.gif"/>"/></a></b>',record.data.id);
}
這句法不ExtJS4.2分辯,因爲現在的String.format是分機.String.format但是當我做這個改變nothig發生。
我嘗試使用新actioncolumn在列定義是這樣的:
{
xtype:'actioncolumn',
text: "download",
width:80,
items: [{
sortable: false,
align:'center',
iconCls: 'download_icon',
hrefTarget: '_blank',
handler: function(grid, rowIndex, colIndex) {
var rec = reportPanel.getStore().getAt(rowIndex);
return Ext.String.format('<b><a href="<c:url value='/fileDownload.action?id={0}'/>" title="download.tooltip"></a></b>',rec.id);
}
}]
}
但什麼是錯的,因爲JavaScript調試器不作出任何類型的錯誤。 在此先感謝。
謝謝,我從來沒有使用templatecolumn,但只是我需要.. – AfanfeFana