|
20 | 20 | * <ul style='list-style-type: none'>
|
21 | 21 | * <li>.header - (string) Text label for a column header
|
22 | 22 | * <li>.itemField - (string) Item field to associate with a particular column.
|
23 |
| - * <li>.templateFn - (function) (optional) Template function used to render each cell of the column. Pro: more performant than `htmlTemplate`. Con: doesn't support AngularJS directives in the template, therefore it doesn't support things like ng-click. Example: <pre>templateFn: value => `<span class="text-danger">${value}</span>`</pre> |
| 23 | + * <li>.templateFn - (function(value, item)) (optional) Template function used to render each cell of the column. Pro: more performant than `htmlTemplate`. Con: doesn't support AngularJS directives in the template, therefore it doesn't support things like ng-click. Example: <pre>templateFn: (value, item) => `<a href="${item.id}">${value}</a>`</pre> |
24 | 24 | * <li>.htmlTemplate - (string) (optional) id/name of an embedded ng/html template. Pro: supports AngularJS directives in the template. Con: poor performance on large tables. Ex: htmlTemplate="name_template.html". The template will be used to render each cell of the column.
|
25 | 25 | * Use <code>handleColAction(key, value)</code> in the template to call the <code>colActionFn</code> callback function you specify. 'key' is the item attribute name; which should equal the itemFld of a column.
|
26 | 26 | * 'value' is the item[key] value.
|
|
110 | 110 | { header: "Status", itemField: "status", htmlTemplate: "status_template.html" },
|
111 | 111 | { header: "Name", itemField: "name", htmlTemplate: "name_template.html", colActionFn: onNameClick },
|
112 | 112 | { header: "Address", itemField: "address"},
|
113 |
| - { header: "City", itemField: "city", templateFn: function(value) { return '<span class="text-success">' + value + '</span>' } }, |
| 113 | + { header: "City", itemField: "city", templateFn: function(value, item) { return '<a href="#' + item.name + '" title="' + item.address + '">' + value + '</span>' } }, |
114 | 114 | { header: "State", itemField: "state"}
|
115 | 115 | ];
|
116 | 116 |
|
|
0 commit comments