| newColumn.template = '<a target="_blank" rel='nofollow' href=' + '"' + Settings.linkurl + '${' + Settings.linkRef + '}">${' + Settings.linkColumn + '}</a>' |
| newColumn.template = '<a target="_blank" rel='nofollow' href=' + '"' + Settings.linkurl + '${' + Settings.linkRef + '}">${getFormattedField(' + Settings.linkColumn + ',' + Settings.yindex.aggregatetype + ',' + Settings.yindex.optionalFormatting + ')}</a>' |
The function getFormattedField never gets called, so no dice there.
|
(window as DateFormat).format = (value: Date) => {
return instance.formatDate(value, { skeleton: 'yMd', type: 'date' });
};
interface DateFormat extends Window {
format?: Function;
}
let grid: Grid = new Grid({
dataSource: new DataManager(employeeData as JSON[]).executeLocal(new Query().take(8)),
columns: [
{ field: 'EmployeeID', headerText: 'Employee ID', textAlign: 'Right', width: 125 },
{ field: 'FirstName', headerText: 'Name', width: 120 },
{ field: 'Title', headerText: 'Title', width: 170 },
{
field: 'HireDate', headerText: 'Hire Date', textAlign: 'Right',
width: 135, template: '#template'
},
{ field: 'ReportsTo', headerText: 'Reports To', width: 120, textAlign: 'Right' }
],
width: 'auto',
height: 359
});
grid.appendTo('#Grid');
|
|
Index.html
<script id="template" type="text/x-template">
<div class="image">
<td>${format(data.HireDate)} </td>
</div>
</script> |
|
Index.html
<script id="template" type="text/x-template">
<div class="image">
<a rel='nofollow' rel='nofollow' href="https://en.wikipedia.org/wiki/${EmployeeID}"> ${format(data.HireDate)} </a>
</div>
</script> |
|
Index.html
<script id="template" type="text/x-template">
<div class="image"> //data parameter contain current row information
<a rel='nofollow' rel='nofollow' href="${getUrl(data, data.HireDate)}/${FirstName}">${format(data , data.HireDate)}</a>
</div>
</script> |
|
Index.js
window.getUrl = function (data, value) {
return "https://en.wikipedia.org/wiki/" + data.FirstName; //generating dynamic link
}; |
|
Index.html
<script id="template" type="text/x-template">
<div class="image"> //passing data and value
<a rel='nofollow' rel='nofollow' href="${getUrl(data, data.HireDate)}/${FirstName}">${format(data , data.HireDate)}</a>
</div>
</script> |
|
Index.js
window.format = function (data, value) {
return "Date:" + " " + instance.formatDate(value, { skeleton: 'yMd', type: 'date' }) + "<br>" + //format the multivalues
"LastName:" + " " + data.LastName.toLocaleUpperCase();
}; |