Can we enable/disable the main search box dynamically in datatable
Can we enable/disable the main search box dynamically in datatable
1) Below is the example -
for example -
Case 1 - When I typing on the search name text box then I need to disable the main search box
Case 2 - When I typing on the main search box then below all text boxes should be disabled.
http://live.datatables.net/qunodalu/1/edit
Q 2) If you check this example there are 2 ascending symbol is present
1st in the header and 2nd one near the text box below I have attached image.
So I just want a header sort symbol.
http://live.datatables.net/qunodalu/1/edit
Thank you,
Neha
This question has accepted answers - jump to:
Answers
See if this Stack Overflow thread helps you with disabling the inputs.
Kevin
Hello, Kevin
Thanks for the quick response.
In the above thread, they disable the button but I want to disable the text box in the data table.
So please check once this example -
http://live.datatables.net/qunodalu/1/edit
and check my 2nd question also.
Thank you,
Neha
Using the techniques described in that SO thread I updated your example to disable the column search inputs if there is text typed in the global search:
http://live.datatables.net/qunodalu/9/edit
You can do something similar to disable/enable the global search if there is text typed in one of the column searches. Note I added a classname to the column search inputs to use as the selector for disabling/enabling.
Kevin
For the second question clone the header before initializing Datatables so the sort click events aren't cloned. Then use
orderCellsTop
to place the sorting click events in the top header.Kevin
Hello Kevin,
But the orderCellsTop option is not working so can you give another solution?
Thank you,
Neha
What happens?
I updated the example and it works:
http://live.datatables.net/qunodalu/11/edit
Kevin
Yes.Thank you so much, Kevin.
You have written this orderCellsTop: true after the clone statement ie. $('#example thead tr').clone(true).appendTo( '#example thead' );
So that's why it's working now.
Thank you,
Neha