DataTable clearFilter() not working properly

前端 未结 4 901
失恋的感觉
失恋的感觉 2021-02-02 14:33

I have a complicate JSF that contain dataTable with filter in each one of the columns. In order to make sure that the generate button will fetch all the data first I need to cle

4条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-02 14:48

    To clear all the inputs of the filters you can do it by javascript:

    
    

    vtWidget is the widgetVar of the datatable.

    Basically clearFilters() will clear the fields for you and call filter(), and the filter function would update your datatable, which in turns will empty the filtered list.

    Note: This would work only if the filters were inputText. If you have custom components then you should implement your own clear based on the components that you have.

    Sometimes if you have custom components, you need to empty the filtered list manually, as you did in the comments!

提交回复
热议问题