简体   繁体   English

如何收集 yadcf 过滤表的所有 id 值

[英]How to collect all the id values for a yadcf filtered table

I'm using datatables and yadcf to filter a table.我正在使用数据表和 yadcf过滤表。 Now I'd like to take all the table row id values, for example, and use those as arguments in a POST request.例如,现在我想获取所有表行 id 值,并将它们用作 POST 请求中的参数。 How can I "collect" the values of these ids from the result of the filters that have been applied?如何从已应用的过滤器的结果中“收集”这些 id 的值? I've seen this example , which doesn't seem to apply to yadcf , but is similar to my use-case.我看过这个例子,它似乎不适用于yadcf ,但与我的用例相似。

Yes, the submit content is only the visible row with datatables.是的,提交内容只是带有数据表的可见行。

If you have 5 rows and after filter 2 rows, if you click on submit button with the active filter only 2 rows will be submitted.如果您有 5 行并且在过滤 2 行之后,如果您单击带有活动过滤器的提交按钮,则只会提交 2 行。

And if, conversely, you still wanted to submit all the elements of the table despite the filtering, on the onsubmit there is a yadcf function that you just have to execute which deactivates all active filtering to submit the entire table like this :相反,如果您仍然想提交表格的所有元素,尽管过滤了,在 onsubmit 上有一个 yadcf 函数,您只需执行该函数即可停用所有活动过滤以提交整个表格,如下所示:

var table = $('#mytable').DataTable( {}) ;
document.onsubmit = function(){ 
    yadcf.exResetAllFilters(table) ;  
};

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Vue:同时收集所有(或部分)表单值 - Vue: Collect all (or some) form values simultaneously 如何从一个输入字段收集所有输入 - How to collect all inputs from one input field 如何让 PHP Contact 表单收集所有选中的复选框 - How to make PHP Contact form collect all selected checkboxes 如何在复选框中收集选中的值作为javascript数组/字符串? - How to collect checked values in checkboxes as a javascript array/string? 如何创建表单以将新记录输入到仅包含来自其他表的 ID 值的表中? - How do I create a form to input new records into a table that contains only ID values from other tables? 在 jQuery 的表格中收集所有项目 - Collect all the items in a form in jQuery 如何解决当虚拟数据存储在 Django 数据库中且其 id 为 none 且所有值为 null 时的错误 - How to solve the error when dummy data gets stored in Django database with its id as none and all values as null 如何仅使用选定的行和值而不是所有行和值来打印和打印预览我的表? - How to print and print preview my table only with a selected row and value instead of all the row and values? zf2使用过滤后的值重新填充表单 - zf2 repopulate form with filtered values Javascript循环收集页面上的所有表单 - Javascript loop to collect all forms on page
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM