Reputation: 2174
I want to put a download link inside Dojo grid . can any one provide me way to generating link in json
Layout var layout = [{ field: 'id', name: 'id', width: '100px' }, { field: 'Download', name: 'Download', width: '100px' }];
Java code for generation Json
JSONObject json = new JSONObject();
json.put("Id", "1");
json.put("ProductName", "Download Link");
JSONArray finalArray = new JSONArray();
finalArray.add(json);
setResponse(getTopLevelJsonObject(finalArray).serialize(true));
Upvotes: 0
Views: 183
Reputation: 10001
If you're asking how to put a link in a dgrid
cell, then you need to override the column's renderCell
function.
e.g.
columns: {
id: {label:'ID'},
name: {
label:'Name',
renderCell: function(object, value, node, options) {
var anchor = domConstruct.create("a");
anchor.href = "http://www.google.com";
anchor.innerHTML = value;
return anchor;
}
}
},
Here's a jsfiddle of an anchor/link in a dgrid cell.
Upvotes: 1