浏览代码

Update the icons option.

zhixin 11 年之前
父节点
当前提交
f983034ade
共有 2 个文件被更改,包括 8 次插入4 次删除
  1. 1 1
      docs/_includes/documentation/table-options.md
  2. 7 3
      src/bootstrap-table.js

+ 1 - 1
docs/_includes/documentation/table-options.md

@@ -77,7 +77,7 @@ The table options is defined in `jQuery.fn.bootstrapTable.defaults`.
     </tr>
     <tr>
         <td>icons</td>
-        <td>-</td>
+        <td>data-icons</td>
         <td>Object</td>
         <td>{<br/>
         &nbsp;&nbsp;refresh: 'glyphicon-refresh icon-refresh',<br/>

+ 7 - 3
src/bootstrap-table.js

@@ -560,17 +560,21 @@
         // showColumns, showToggle, showRefresh
         html = ['<div class="columns columns-' + this.options.toolbarAlign + ' btn-group pull-' + this.options.toolbarAlign + '">'];
 
+        if (typeof this.options.icons === 'string') {
+            this.options.icons = calculateObjectValue(null, this.options.icons);
+        }
+
         if (this.options.showRefresh) {
             html.push(sprintf('<button class="btn btn-default" type="button" name="refresh" title="%s">',
                 this.options.formatRefresh()),
-                '<i class="'+this.options.iconsPrefix+' '+this.options.icons.refresh+'"></i>',
+                sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.refresh),
                 '</button>');
         }
 
         if (this.options.showToggle) {
             html.push(sprintf('<button class="btn btn-default" type="button" name="toggle" title="%s">',
                 this.options.formatToggle()),
-                '<i class="'+this.options.iconsPrefix+' '+this.options.icons.toggle+'"></i>',
+                sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.toggle),
                 '</button>');
         }
 
@@ -578,7 +582,7 @@
             html.push(sprintf('<div class="keep-open btn-group" title="%s">',
                 this.options.formatColumns()),
                 '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">',
-                '<i class="'+this.options.iconsPrefix+' '+this.options.icons.columns+'"></i>',
+                sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.columns),
                 ' <span class="caret"></span>',
                 '</button>',
                 '<ul class="dropdown-menu" role="menu">');