aslagle / reactive-table

A reactive table designed for Meteor
https://atmospherejs.com/aslagle/reactive-table
Other
328 stars 137 forks source link

Clear showFilter property in reactive table #372

Open sakshi-kataria opened 8 years ago

sakshi-kataria commented 8 years ago

In setting of reactive table there is a option

showFilter: Boolean. Whether to display the filter box above the table. Default true Initially i filter some text from this filter and than on a button click i want to clear filter by code how this can be possible

means is there any option to clear filter by code

aslagle commented 8 years ago

If you're just trying to clear the filter box and have the table update, you can do this: $('.reactive-table-filter input').val("").trigger("input").

If you need something more complicated, you could try the custom filters option: https://github.com/aslagle/reactive-table#custom-filters

sakshi-kataria commented 8 years ago

Thanks its working and i already used custom filter in my project it is working

sakshi-kataria commented 8 years ago

when i am using custome filter with $('.reactive-table-filter input').val("").trigger("input"). then $('.reactive-table-filter input').val("").trigger("input"). is not working

sakshi-kataria commented 8 years ago

it is not working because on rendered i am not able to access filter textbox if page gets complete load than I can access textbox through console so please suggest where can I define "$('.reactive-table-filter input').val("").trigger("input")" ????

aslagle commented 8 years ago

If you're using custom filters, there's a ReactiveTable.clearFilters function. It doesn't need the filter to be rendered. Pass it a list of filter ids - ReactiveTable.clearFilters(['filter1', 'filter2', 'filter3']);

sakshi-kataria commented 8 years ago

hey but I am using both custome filter and default filter box to search and i want to clear that filter box textbox

aslagle commented 8 years ago

The default filter also has an id you can use with ReactiveTable.clearFilters. You can set an id for the table so it will be fixed - for example if you set the table's id to "my-id", the filter's id will be "my-id-filter".