Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Why does datatables not know about the input elements?


Asked by Isaac Hood on Dec 02, 2021 FAQ



This is correct - to explain why: DataTables doesn't know anything about the input elements themselves since it is just the API method that are being called with values. You would need to also reset the input elements as well as using this method.
Besides,
When there is INPUT or SELECT element present in the table cell, DataTables plug-in ignores its value during searching or ordering. To make DataTables aware of the actual value of the SELECT or INPUT element, we can dynamically generate cell content for various operations.
Similarly, This example shows $ () being used to get all input elements from the table. In the example a simple alert () is used to show the information from the form, but an Ajax call to the server with the form data could easily be performed.
Indeed,
To make DataTables aware of the actual value of the SELECT or INPUT element, we can dynamically generate cell content for various operations. This can be done by returning element’s value in a callback defined by columnDefs.render option for filtering ( type equals to filter) and searching ( type equals to sort) operations.
Next,
When that happens, we can set “Select all” control to a special state indeterminate to indicate that only some checkboxes are checked. When table is enhanced by jQuery DataTables plug-in, only visible elements exist in DOM. That is why by default form submits checkboxes from current page only.