ソースを参照

Merge pull request #941 from tannermccoleman/master

Use options for detailView's open/close icons
文翼 10 年 前
コミット
add756e3d9
2 ファイル変更16 行追加9 行削除
  1. 10 5
      docs/_i18n/en/documentation/table-options.md
  2. 6 4
      src/bootstrap-table.js

+ 10 - 5
docs/_i18n/en/documentation/table-options.md

@@ -81,11 +81,16 @@ The table options is defined in `jQuery.fn.bootstrapTable.defaults`.
         <td>data-icons</td>
         <td>Object</td>
         <td>{<br/>
-        &nbsp;&nbsp;refresh: 'glyphicon-refresh icon-refresh',<br/>
-        &nbsp;&nbsp;toggle: 'glyphicon-list-alt icon-list-alt',<br/>
-        &nbsp;&nbsp;columns: 'glyphicon-th icon-th'<br/>
-        }</td>
-        <td>Defines icons that used for refresh, toggle and columns buttons</td>
+        &nbsp;&nbsp;<i>paginationSwitchDown:</i> 'glyphicon-collapse-down icon-chevron-down',<br/>
+        &nbsp;&nbsp;<i>paginationSwitchUp:</i> 'glyphicon-collapse-up icon-chevron-up',<br/>
+        &nbsp;&nbsp;<i>refresh:</i> 'glyphicon-refresh icon-refresh',<br/>
+        &nbsp;&nbsp;<i>toggle:</i> 'glyphicon-list-alt icon-list-alt',<br/>
+        &nbsp;&nbsp;<i>columns:</i> 'glyphicon-th icon-th',<br/>
+        &nbsp;&nbsp;<i>detailOpen:</i> 'glyphicon-plus icon-plus',<br/>
+        &nbsp;&nbsp;<i>detailClose:</i> 'glyphicon-minus icon-minus'<br/>
+        }
+        </td>
+        <td>Defines icons used in the toolbar, pagination, and details view.</td>
     </tr>
     <tr>
         <td>columns</td>

+ 6 - 4
src/bootstrap-table.js

@@ -255,7 +255,9 @@
             paginationSwitchUp: 'glyphicon-collapse-up icon-chevron-up',
             refresh: 'glyphicon-refresh icon-refresh',
             toggle: 'glyphicon-list-alt icon-list-alt',
-            columns: 'glyphicon-th icon-th'
+            columns: 'glyphicon-th icon-th',
+            detailOpen: 'glyphicon-plus icon-plus',
+            detailClose: 'glyphicon-minus icon-minus'
         },
 
         rowStyle: function (row, index) {
@@ -1301,7 +1303,7 @@
             if (!this.options.cardView && this.options.detailView) {
                 html.push('<td>',
                     '<a class="detail-icon" href="javascript:">',
-                    '<i class="glyphicon glyphicon-plus icon-plus"></i>',
+                    sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.detailOpen),
                     '</a>',
                     '</td>');
             }
@@ -1457,11 +1459,11 @@
 
             // remove and update
             if ($tr.next().is('tr.detail-view')) {
-                $this.find('i').attr('class', 'glyphicon glyphicon-plus icon-plus');
+                $this.find('i').attr('class', sprintf('%s %s', that.options.iconsPrefix, that.options.icons.detailOpen));
                 $tr.next().remove();
                 that.trigger('collapse-row', index, row);
             } else {
-                $this.find('i').attr('class', 'glyphicon glyphicon-minus icon-minus');
+                $this.find('i').attr('class', sprintf('%s %s', that.options.iconsPrefix, that.options.icons.detailClose));
                 $tr.after(sprintf('<tr class="detail-view"><td colspan="%s">%s</td></tr>',
                     $tr.find('td').length, calculateObjectValue(that.options,
                         that.options.detailFormatter, [index, row], '')));