Filter tables generated by ng-repeat in version 1.9.4
Filter tables generated by ng-repeat in version 1.9.4

Hello everyone. I'm new to Datables, hope someone can help me with this. So I have a number of tables generated by Angular ng-repeat
from json data. All of them have class'results-table'
. Then I init datatables like that
$('table.results-table').DataTable({
sPaginationType: 'full_numbers'
});
I need to filter all tables according to value set in dropdown and refresh them. But in my tables I don't have column for filtering values. I guess it's posible to add hidden column like
"bSearchable": true,
"bVisible": false
and then filter by it. So does anyone have idea how can I implement such filtering and then refresh datatables. When I tried to filter the data used to generate it, the datatables were not updated. Also I need to use 1.9.4 version only.
Answers
Not sure why you need to stick with Datatables 1.9.4. I don't believe the developers are going to fix any issues you find. You should consider upgrading to 1.10. It supports the legacy configuration options so it might be worth trying.
Here are a couple of 1.9 examples to filter columns:
https://legacy.datatables.net/release-datatables/examples/api/multi_filter.html
https://legacy.datatables.net/release-datatables/examples/api/multi_filter_select.html
Is this what you are looking for?
Kevin
Not exactly. I have one dropdown on the higher level and need to use it's value to filter all tables generated by
ng-repeat
. So can I access them by class name or as another option if I filter my JSON data used inng-repeat
how can I force datatables to redraw?fnDraw
maybe?Hi @Jigly ,
As Kevin said, it would be worth considering an update - there's been many fixes and improvements since that release.
Cheers,
Colin
I've never used 1.9 but according to the Conversion Guide
fnDraw
is the same adraw()
which redraws the table. However I don't think that will be enough for you. You actually need to search the table. You can probably do something along the lines of this example I posted for you:https://legacy.datatables.net/release-datatables/examples/api/multi_filter_select.html
At the bottom of the JS code it is searching based on the selected item.
Here are a couple other examples you can look at that use text inputs. They should give you an idea of what you need to do.
https://legacy.datatables.net/release-datatables/examples/plug-ins/range_filtering.html
https://legacy.datatables.net/release-datatables/examples/api/regex.html
Kevin