【发布时间】:2019-03-16 05:32:12
【问题描述】:
我可以在上面的复选框操作中删除列数据和标题。但是因为我正在使用 tablesorter 插件。过滤器不会隐藏和消失。它消耗了我们想为扩展表视图提供的额外空间。
请看两张图片以便更好地参考和理解?
我希望@Mottie 能提出一些解决方案。
这是我现在的结构
<table class="table table-striped" id="someussta">
<div class="btn-cal-group pull-right"> <a href="#" id="downsta" class="btn btn-sm bg-blue">Export Results Excel</a>
<a href="#" id="testussta" type="button" onclick="exportPDFResults();" class="btn btn-sm bg-blue">Export Results pdf</a></div>
<thead>
<tr> <div> <b> ** Customize Column ** </b> </div> <div id="grpChkussta">
<p>
<input type="checkbox" name="Dcou" /> State
<input type="checkbox" name="sresu" /> Search Result
<input type="checkbox" name="mflag" /> Flag
<input type="checkbox" name="mcomm" /> Comment
<input type="checkbox" name="mname" /> Trademark Name
<input type="checkbox" name="mtype" />Trademark No.
<input type="checkbox" name="mleg" /> Legal Status</p>
</div></tr>
<tr> <div id="sticky" class="sticky">
<th style="width: 10px"><input type="checkbox" id="inp-chkboxsta"></th>
<!-- <th>Mark Image</th> -->
<th class="Dcou">State</th>
<th class="sresu">Search Result</th>
<th class="mflag"> Flag </th>
<th class="mcomm"> Comment </th>
<th class="mname">Trademark Name</th>
<th class="mtype">Trademark No.</th>
<th class="mleg">Legal Status</th>
<!-- <th>Web link</th> -->
</div> </tr> </thead>
<tbody>
{% for result in cat.results %}
<tr id="someussta" class="content">
<td><input type="checkbox" name="tuesday[]" data-pid="{{result.id_}}" class="inpchksta"></td>
<td class="Dcou">{% for state in result.designatedContractedStates %}
{{state}}
{% endfor %}</td>
<td class="sresu">{{result.trademarkType}}</td>
<td width="125" class="{{result.id_}}">
<td class="mname"><a data-toggle="modal" class="tm" data-target="#TMResultModal" data-tid="{{result.id_}}">{{result.markName}}</a></td>
<td class="mreg">{{ (result.registrtionNo|string).rstrip('0').rstrip('.') }}</td>
<td class="mleg">{{result.legalStatus}}</td>
<!-- <td>{{result.goodsServices}}</td> -->
</tr>
{% endfor %}</tbody>
</table>
这是我用来从表格中隐藏我的列的函数。
$(function () {
var $chk = $("#grpChkussta input:checkbox");
var $tbl = $("#someussta");
$chk.prop('checked', true);
$chk.click(function () {
var colToHide = $tbl.find("." + $(this).attr("name"));
$(colToHide).toggle();
});
});
【问题讨论】:
-
@Mottie 我希望你能理解我面临的问题。
标签: jquery filter jquery-plugins tablesorter