Reviewed-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
On 03/11/2014 07:09 AM, Hongliang Wang wrote:
Allow programmer to specify whether to add a "title"
attribute to a
column if he/she is aware that the column may have very long value.
Signed-off-by: Hongliang Wang <hlwang(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.grid.js | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/ui/js/src/kimchi.grid.js b/ui/js/src/kimchi.grid.js
index 20cacc5..215d6ea 100644
--- a/ui/js/src/kimchi.grid.js
+++ b/ui/js/src/kimchi.grid.js
@@ -158,9 +158,13 @@ kimchi.widget.Grid = function(params) {
var rowNode = $('<tr></tr>').appendTo(tbody);
$.each(fields, function(fi, field) {
var fieldName = field['name'];
- $('<td><div class="cell-text-wrapper">' +
- row[fieldName] +
- '</div></td>').appendTo(rowNode);
+ var value = row[fieldName];
+ $('<td><div class="cell-text-wrapper"' +
+ (field['makeTitle'] === true
+ ? ' title="' + value + '"'
+ : ''
+ ) + '>' + value + '</div></td>'
+ ).appendTo(rowNode);
});
});
};