-1

我对 CSS/html 有点陌生。我正在尝试使用 tablesorter 包含这个 jquery 插件,它基本上可以让你的列排序。当单击表的标题以按升序/降序对列进行排序时,它看起来会更改类类型。我正在尝试遵循本教程:http ://weblogs.asp.net/hajan/archive/2011/02/09/table-sorting-amp-pagination-with-jquery-in-asp-net-mvc.aspx

所以在我的一个专栏中,能够排序是没有意义的,因为它都是一样的。我从一个 asp.net/mvc3 应用程序开始,我指的是最后一列,您可以在其中单击“详细信息”。由于这不会改变,我希望该列中没有向上/向下箭头。原始的 css 看起来像:

table.tablesorter {
    font-family:arial;
    background-color: #CDCDCD;
    margin:10px 0pt 15px;
    font-size: 11pt;
    width: 100%;
    text-align: left;
}
table.tablesorter thead tr th, table.tablesorter tfoot tr th {
    background-color: #e6EEEE;
    border: 1px solid #FFF;
    font-size: 10pt;
    padding: 4px;
}
table.tablesorter thead tr .header {
    background-image: url(themes/base/images/bg.gif);
    background-repeat: no-repeat;
    background-position: center right;
    cursor: pointer;
}
table.tablesorter tbody td {
    color: #3D3D3D;
    padding: 4px;
    background-color: #FFF;
    vertical-align: top;
}
table.tablesorter tbody tr.odd td {
    background-color:#F0F0F6;
}
table.tablesorter thead tr .headerSortUp {
    background-image: url(themes/base/images/asc.gif);
}
table.tablesorter thead tr .headerSortDown {
    background-image: url(themes/base/images/desc.gif);
}
table.tablesorter thead tr .headerSortDown, table.tablesorter thead tr .headerSortUp {
    background-color: #8dbdd8;
}

所以我想我可以添加:

table.tablesorter thead .nostyle {
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    font-size: 100%;
    vertical-align: baseline;
    background-color: #8dbdd8;
}

然后在我不想要样式的标题中,执行以下操作:

            <th class="#nostyle"></th>

但这不起作用。我这样做对吗?或者,还有更好的方法?谢谢!

4

3 回答 3

1

因为你的课不对。类#nostyle不匹配.nostyle.nostyle匹配元素class="nostyle"

<th class="nostyle"></th>
于 2013-01-12T02:39:43.923 回答
1

为什么不简单地禁用对这些列的排序?

http://tablesorter.com/docs/#Configuration

查找“标题”设置:

headers Object null 用于按列控制的指令对象,格式为: headers: { 0: { option: setting }, ... } 例如,禁用对表的前两列进行排序: headers: { 0 :{分拣机:假},1:{分拣机:假}}

于 2013-01-12T02:41:21.603 回答
0

如果你用过

table.tablesorter thead .nostyle 

你的班级应该是 'nostyle' 而不是 '#nostyle' 例如:

  <th class="nostyle"></th>
于 2013-01-12T02:40:38.903 回答