gridpanel - Download file on row click, in extjs4 -
i have grid panel column if click downalod file associate row. in extjs 2 define new renderer function return return string format of url this:
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); }
this syntax not rigth in extjs4.2 because string.format ext.string.format when made change nothig happens.
i try use new actioncolumn in column definition in way:
{ 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); } }] }
but wrong because javascript debugger doesn't made type of error. in advance.
the handler
property of actioncolumn
(witch renders icon, or series of icons in grid cell, , offers scoped click handler each icon) documented as:
a function called when icon clicked.
consider using templatecolumn
(witch renders value processing model's data using configured xtemplate) instead , passing tpl
property.
Comments
Post a Comment