Search code examples
javascriptjquerytwitter-bootstrapbootstrap-table

How do I Display all data after filtering


I am using bootstrap-table by wenzhixin on Github it is this one

I want to do a button that would toggle filter, Filtering works but when I try do display all the Data again In does not Work, I have struggled with this issue in two days but I can't figure out how to do it.

I tried

  1. $('#table').bootstrapTable('load', $('#table').bootstrapTable('getData')); but It doesn't work it seems that getData gives the already filtered data

  2. $('#table').bootstrapTable('load', data); where data is the array of my Data but it does not change anything

  3. I wanted to use $('#table').bootstrapTable('refresh') ,but It does not support local data.

Here is my JSFiddler https://jsfiddle.net/pacitwizere/4y3079s7/2/


Solution

  • Your data variable will not be updated by bootstrapTable filterBy feature. Adding the following line to your click functions will make it work.

    $('#table').bootstrapTable("filterBy", )
    
    $('#table').bootstrapTable("filterBy", {"forks_count": ["11","4"]})
    

    How about this? https://jsfiddle.net/4y3079s7/4/