gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 15:16:30 34 4
gpt4 key购买 nike

我使用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({
});

最佳答案

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

$(function(){
$('#table3').bootstrapTable(
{"sortName": "CustomerName","sortOrder":"desc"});
});

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

工作中JSFiddle .

关于javascript - Bootstrap 表 - 多排序扩展中的 sortPriority 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34433235/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com