Bootstrap表 - 多排序扩展中的sortPriority不起作用

时间:2015-12-23 10:11:09

标签: javascript jquery twitter-bootstrap twitter-bootstrap-3 bootstrap-table

我使用bootstrap-tablemultiple-sort扩展名。在此jsfiddle正在进行扩展。在我的表中,第一列的初始顺序是错误的(看起来没有执行初始排序),我不知道为什么。

jsfiddle

HTML

<table class="table table-striped table-bordered table-hover" cellspacing="0" id="table3" data-show-columns="true" data-show-multi-sort="true" data-sort-priority='[{"sortName":"CustomerName","sortOrder":"desc"}]'>
   <thead>
      <tr>
         <th data-field="CustomerName" data-sortable="true">CustomerN</th>
         <th data-field="ProjectName" data-sortable="true">ProjectN</th>
         <th data-field="ProjectType" data-sortable="true">ProjectT</th>
         <th data-field="ProjectDetails" data-sortable="true">ProjectD</th>
      </tr>
   </thead>
   <tbody>
      <tr>
         <td>Capital Corporation</td>
         <td>Services SOW #1</td>
         <td>Project | T&amp;M</td>
         <td>"Inani fabulas nominavi sea no.\n"+ 
            "Ad quodsi luptatum expetenda eum, sed ludus dicam\n"+ 
            "nominati te, reque causae prompta eos ex. Putent \n"+
            "torquatos mei ei. Te verear offendit per. Vix eu erant\n"+ 
            "doctus delenit, et copiosae indoctum accommodare eum.\n"+ 
            "Errem tritani in qui, te vis legere saperet corpora.\n"+ 
            "Eu mei nobis pertinacia, in has putent virtute voluptua,\n"+ 
            "ne probo dicta utinam nam."
         </td>
      </tr>
      <tr>
         <td>GE Capital Corporation</td>
         <td>Services SOW #1</td>
         <td>Project | T&amp;M</td>
         <td>"Inani fabulas nominavi sea no.\n"+ 
            "Ad quodsi luptatum expetenda eum, sed ludus dicam\n"+ 
            "nominati te, reque causae prompta eos ex. Putent \n"+
            "torquatos mei ei. Te verear offendit per. Vix eu erant\n"+ 
            "doctus delenit, et copiosae indoctum accommodare eum.\n"+ 
            "Errem tritani in qui, te vis legere saperet corpora.\n"+ 
            "Eu mei nobis pertinacia, in has putent virtute voluptua,\n"+ 
            "ne probo dicta utinam nam."
         </td>
      </tr>
      <tr>
         <td>Corporation</td>
         <td>Services SOW #1</td>
         <td>Project | T&amp;M</td>
         <td>"Inani fabulas nominavi sea no.\n"+ 
            "Ad quodsi luptatum expetenda eum, sed ludus dicam\n"+ 
            "nominati te, reque causae prompta eos ex. Putent \n"+
            "torquatos mei ei. Te verear offendit per. Vix eu erant\n"+ 
            "doctus delenit, et copiosae indoctum accommodare eum.\n"+ 
            "Errem tritani in qui, te vis legere saperet corpora.\n"+ 
            "Eu mei nobis pertinacia, in has putent virtute voluptua,\n"+ 
            "ne probo dicta utinam nam."
         </td>
      </tr>
   </tbody>
</table>

的javascript

$('#table3').bootstrapTable({
});

1 个答案:

答案 0 :(得分:2)

您可以传递初始配置选项,以便在jQuery本身初始化表时完成排序:

=DLookup("TotalAmount","YourQuery","Cust_ID=" & Me.Cust_ID & "")

如果在初始化表时没有传递任何排序选项,除了启用排序外,它不会执行任何操作。

工作JSFiddle