刷新后数据表搜索为空,但过滤器处于活动状态(Data Table Search is Empty After Refresh but Filter is Active)
所以我认为这可能是数据表lib中的一个错误。 我只能使用jsfiddle中的示例代码重现这一点。
重新创建的步骤:
- 打开JS Fiddle链接https://jsfiddle.net/t4rphnuc/
- 点击“运行”
- 在页脚搜索框中(无关紧要)过滤数据表
- 再次单击“运行”或刷新页面(您需要执行两次步骤2-4,因为JSFiddle第一次不缓存数据表)
注意:数据表仍然保持过滤,但搜索字段现在都是空的。
有没有其他人看过这个或看到我在这里做错了什么?
这是javascript
<script src="js/jquery.js" type="text/javascript"></script> <script src="js/jquery.dataTables.js" type="text/javascript"></script> <script src='https://code.jquery.com/jquery-1.12.4.js'></script> <script src='https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js' type="text/javascript"></script> <script src='https://cdn.datatables.net/select/1.2.5/js/dataTables.select.min.js' type="text/javascript"></script> <script src='https://cdn.datatables.net/buttons/1.5.1/js/dataTables.buttons.min.js' type="text/javascript"></script> <script src='https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js' type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { const table = $('#example').DataTable({ stateSave: true }); // Setup - add a text input to each footer cell $('#example tfoot th').each( function () { var title = $(this).text(); $(this).html( '<input type="text" placeholder="Search '+title+'" />' ); } ); // Apply the search table.columns().every( function () { var that = this; $( 'input', this.footer() ).on( 'keyup change', function () { if ( that.search() !== this.value ) { that .search( this.value ) .draw(); } } ); } ); } ); </script>
大多数代码都来自此链接https://datatables.net/examples/api/multi_filter.html
预期的功能是数据表应该在加载之间保存状态,并且搜索框应该在页面重新加载时重新加载过滤的文本。
So I think this might be a bug in the data tables lib. I was able to reproduce this using just their example code in jsfiddle.
Steps to recreate:
- Open JS Fiddle link https://jsfiddle.net/t4rphnuc/
- Click "Run"
- In a footer search box (doesn't matter which) filter the data table
- Click "Run" again or refresh the page (you'll need to do steps 2-4 twice because JSFiddle doesn't cache the data table the first time)
NOTE: The Data table still remains filtered but the search fields are now all empty.
Has anyone else seen this or see something I'm doing wrong here?
This is the javascript
<script src="js/jquery.js" type="text/javascript"></script> <script src="js/jquery.dataTables.js" type="text/javascript"></script> <script src='https://code.jquery.com/jquery-1.12.4.js'></script> <script src='https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js' type="text/javascript"></script> <script src='https://cdn.datatables.net/select/1.2.5/js/dataTables.select.min.js' type="text/javascript"></script> <script src='https://cdn.datatables.net/buttons/1.5.1/js/dataTables.buttons.min.js' type="text/javascript"></script> <script src='https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js' type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { const table = $('#example').DataTable({ stateSave: true }); // Setup - add a text input to each footer cell $('#example tfoot th').each( function () { var title = $(this).text(); $(this).html( '<input type="text" placeholder="Search '+title+'" />' ); } ); // Apply the search table.columns().every( function () { var that = this; $( 'input', this.footer() ).on( 'keyup change', function () { if ( that.search() !== this.value ) { that .search( this.value ) .draw(); } } ); } ); } ); </script>
Most of the code was taken from this link https://datatables.net/examples/api/multi_filter.html
The expected functionality is that the data table should save state between loads and the search boxes should reload the filtered text when the page reloads.
原文:https://stackoverflow.com/questions/49878160
满意答案
SELECT C.name, count(*) FROM client C JOIN test T on T.clientId = C.clientId and T.status= 'Fail' group by C.name having count(*) > 2
SELECT C.name, count(*) FROM client C JOIN test T on T.clientId = C.clientId and T.status= 'Fail' group by C.name having count(*) > 2
相关问答
更多如何执行复杂的sql语句并在数组中获取结果?(How to execute a complex sql statement and get the results in an array?)
sql complex case用于计算字段的语句(sql complex case when statement for a calculated field)
SQL使用“AND”+“OR”语句加入(SQL Join with “AND” + “OR” statement)
形成复杂的SQL语句(Forming a complex SQL statement)
复杂的Yii SQL语句(Complex Yii SQL statement)
复杂更新Sql语句(Complex Update Sql Statement)
复杂的SELECT SQL语句(Complex SELECT SQL statement)
带轨道的复杂订单语句AREL:SQL Case语句(Complex order statement with rails AREL: SQL Case statement)
一个复杂的sql语句(A complex sql statement)
复杂删除SQL语句(Complex Delete SQL Statement)
相关文章
更多lucene4.7 过滤Filter(六)
Solr: a custom Search RequestHandler
Custom SOLR Search Components - 2 Dev Tricks
solr faceted search
Realtime Search: Solr vs Elasticsearch
Riak Search
Hibernate Search(基于version3.4)--第五章Querying
ElasticSearch入门-Bulk,Search操作
table-Oceanus配置说明
[How to] Make custom search with Nutch(v 1.0)?(转)
最新问答
更多如何在Laravel 5.2中使用paginate与关系?(How to use paginate with relationships in Laravel 5.2?)
linux的常用命令干什么用的
由于有四个新控制器,Auth刀片是否有任何变化?(Are there any changes in Auth blades due to four new controllers?)
如何交换返回集中的行?(How to swap rows in a return set?)
在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
使用Boost.Spirit Qi和Lex时的空白队长(Whitespace skipper when using Boost.Spirit Qi and Lex)
Java中的不可变类(Immutable class in Java)
WordPress发布查询(WordPress post query)
如何在关系数据库中存储与IPv6兼容的地址(How to store IPv6-compatible address in a relational database)
是否可以检查对象值的条件并返回密钥?(Is it possible to check the condition of a value of an object and JUST return the key?)
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!