How to clear the search, select, checkbox and radio filters at once ?
How to clear the search, select, checkbox and radio filters at once ?
kkvbsuresh
Posts: 32Questions: 6Answers: 0
Link to test case: http://live.datatables.net/cuyukasu/1/edit
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem: Two problems exist and unable to solve self.
1) The search field text clears by clicking the button "Clear All Filters" but table not redraw. Stuck with at the search values.
2) The check boxes only cleared that are visible only in the window while clicking the button "Clear All Filters".
Any help welcome.
Answers
One more problem exists
3) While sorting descending with the custom created buttons the corresponding arrow not active with the parent element at the header.
Forget to mention that the script for Button "Clear All Filters" is available below the table in html section.
You have two functions that are called when clicking the button:
and
The ClearFilters() function generates this error:
The click event has this error:
Looks like you are using the Gyrocode Checkboxes plugin API but you haven't loaded the plugin code nor enabled it in your Datatables config.
I commented out the Gyrocode API calls and change the
$('#clear-filter')
selector to keep it from running. Now the clear button works.The methods you are trying work with the rows in the DOM. When using Datatables the only rows in the DOM are those on the current page. You will need to use an API like
cells().nodes()
. See this exmaple from this thread for one technique to clear the checkboxes.The
order()
API takes the stringsasc
anddesc
. You are usingdes
. I changed the example to usedesc
.The updated example with the above changes:
http://live.datatables.net/cuyukasu/2/edit
Kevin
Datatable,
But still struggle with checkbox clear.
From the answer See this exmaple from this thread for one technique to clear the checkboxes. (http://live.datatables.net/pabewumi/1/edit)
a) unable to sort if it's checked at (http://live.datatables.net/pabewumi/1/edit)
b) unable to give a name to the column at (http://live.datatables.net/pabewumi/1/edit).
Any solution ?
Datatable,
http://live.datatables.net/pabewumi/6/edit
But still the one exists a) unable to sort if it's checked at http://live.datatables.net/pabewumi/6/edit
Any solution or help ?
See this example:
http://live.datatables.net/cubefaqa/6/edit
It keeps track of the checkbox checked state with
1
being checked and undefined or0
being unchecked. This allows for sorting to work. It uses a click event handler to update thecell().data()
appropriately. And it usesrowCallback
to update the checkbox state based on the value.Kevin
Datatable,
Use
cell().data()
to set the value to0
. Here is the updated example:http://live.datatables.net/cubefaqa/8/edit
Note the use of
draw( false )
to stay on the same page. See thedraw()
API for more details.Kevin
Datatable,
The new problem with http://live.datatables.net/cubefaqa/8/edit is unable to select the required one but select works auto in serial format ?
I'm not sure what that means - please can you provide steps on how to reproduce the issue you want help with,
Colin
Datatable,
I don't understand the problem either. When I click an unchecked checkbox it becomes checked. Clicking it again it becomes unchecked. Please provide specific steps to show the problem.
Kevin
Datatable,
first select some rows (checkbox)
then
click the sort up (asc)
and
down (desc)
once the selection is desc and all selected check boxes is invisible
click the button uncheck all to un check all check boxes
then
click the sort up (asc)
and
down (desc)
everything works fine ?
GOOD.
now start again random check box selection
it selects only from top in a serial way ?
at
http://live.datatables.net/cubefaqa/8/edit
I think I see the problem. You are sorting by the checkbox column. When you click a check box the table will be reordered right away so the row you clicked is sorted to the end of the table. I updated the test case to show only a few rows via the
search
option. Try these steps:http://live.datatables.net/cubefaqa/11/edit
Kevin