Browse Source

Added support for title in the TH tag

Dennis Hernández 10 years ago
parent
commit
40cc1d6482

+ 7 - 0
docs/_i18n/en/documentation/column-options.md

@@ -49,6 +49,13 @@ The column options is defined in `jQuery.fn.bootstrapTable.columnDefaults`.
         <td>The column title text.</td>
     </tr>
     <tr>
+        <td>titleTooltip</td>
+        <td>data-title-tooltip</td>
+        <td>String</td>
+        <td>undefined</td>
+        <td>The column title tooltip text. This option also support the title HTML attribute</td>
+    </tr>
+    <tr>
         <td>class</td>
         <td>class / data-class</td>
         <td>String</td>

+ 7 - 0
docs/_i18n/es/documentation/column-options.md

@@ -49,6 +49,13 @@ Las propiedades de la columna están definidas en `jQuery.fn.bootstrapTable.colu
         <td>El título de la columna.</td>
     </tr>
     <tr>
+        <td>titleTooltip</td>
+        <td>data-title-tooltip</td>
+        <td>String</td>
+        <td>undefined</td>
+        <td>Texto del title tooltip de la columna. Esta opción soporta el tag title de HTML.</td>
+    </tr>
+    <tr>
         <td>class</td>
         <td>class / data-class</td>
         <td>String</td>

+ 7 - 0
docs/_i18n/zh-cn/documentation/column-options.md

@@ -49,6 +49,13 @@ The column options is defined in `jQuery.fn.bootstrapTable.columnDefaults`.
         <td>The column title text.</td>
     </tr>
     <tr>
+        <td>titleTooltip</td>
+        <td>data-title-tooltip</td>
+        <td>String</td>
+        <td>undefined</td>
+        <td>The column title tooltip text. This option also support the title HTML attribute</td>
+    </tr>
+    <tr>
         <td>class</td>
         <td>class / data-class</td>
         <td>String</td>

+ 4 - 2
src/bootstrap-table.js

@@ -388,6 +388,7 @@
         checkboxEnabled: true,
         field: undefined,
         title: undefined,
+        titleTooltip: undefined,
         'class': undefined,
         align: undefined, // left, right, center
         halign: undefined, // left, right, center
@@ -507,7 +508,8 @@
         this.$header.find('th').each(function () {
             var column = $.extend({}, {
                 title: $(this).html(),
-                'class': $(this).attr('class')
+                'class': $(this).attr('class'),
+                titleTooltip: $(this).attr('title')
             }, $(this).data());
 
             columns.push(column);
@@ -618,7 +620,7 @@
 
             visibleColumns.push(column);
 
-            html.push('<th',
+            html.push('<th' + sprintf(' title="%s"', column.titleTooltip),
                 column.checkbox || column.radio ?
                 sprintf(' class="bs-checkbox %s"', column['class'] || '') :
                 class_,