[Kimchi-devel] [PATCH] [UI] Grid Enhancement - "title" Attribute for Long Values

Hongliang Wang hlwang at linux.vnet.ibm.com
Tue Mar 11 10:09:44 UTC 2014


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 at 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);
             });
         });
     };
-- 
1.8.1.4




More information about the Kimchi-devel mailing list