Download link
Download link
mariyanandh
Posts: 4Questions: 0Answers: 0
I am using server side processing, I need one column with image indicating downloadable, once the link is selected, I want to make to process download.
How to implement this? please help me.
How to implement this? please help me.
This discussion has been closed.
Replies
Allan
in my db call, I create an extra column (any field will do, I use the ID field a second time) and for that column use fnRender to create the link using an image.
[code]
"aoColumns": [
// ... some other columns first
{
"sName": "id",
"sWidth": 30,
fnRender: function(oObj) {
var id = oObj.aData[0];
return "";
},
"bSortable": false,
"bSearchable": false
},
// ... some other columns after
[/code]
fnRender passes one arg: oObj, which has goodies like the row number, column number, and an array of the entire row's data. (see http://www.datatables.net/ref) in my case, I'm deleting based on the ID, which is in position 0 in the data array.
Your function must return a string; this becomes the HTML of your cell.
qapub_delete.php is my deletion script on server side. in your case, the href will be whatever download resource you intend. graphics/delete.png is my image.
oObj has these parts:
- int:iDataRow - the row in aoData
- int:iDataColumn - the column in question
- array:aData - the data for the row in question
- object:oSettings - the settings object for this DataTables instance