Bootstrap table search function failing once rows have been added to the table.

I have a table that if I attach the bootstrap table options makes the table searchable.
<table data-pagination="true" data-search="true" data-toggle="table">

Open in new window

.
However, once I add rows to the table dynamically (via javascript) the new content loads fine in the table and is formatted as required, but the search option does not work as the table does not seem to be recognising that the new rows have been added. Indeed, if I use the search, it still searches what were the same records that existed in the table before the new rows were added. It's almost as if the table needs to be refreshed.

I have tried removing the options in the table tag that provide the search etc and dynamically applying them with javascript after the rows have been added.
     
                                                table.setAttribute('data-pagination','true');
                                                table.setAttribute('data-search','true');
                                                table.setAttribute('data-toggle','table');
                                                console.log(table);

Open in new window

The console log indicates that the attribute changes have been applied, but the table does not offer the functions.

Having now spent hours experimenting, I am out of ideas, so would be really grateful if someone could shine a light on what might be going wrong?
martmacAsked:
Who is Participating?
 
lenamtlConnect With a Mentor Commented:
Hi,

Bootstrap table provide almost no nothing...

I highly recommend the use of Datatables with responsive option & Yadcf filters.
Don't forget to select Bootstrap version before downloading...
https://datatables.net/download/

Demo and documentation https://datatables.net/

Yadcf
code https://github.com/vedmack/yadcf
demo http://yadcf-showcase.appspot.com/
0
 
martmacAuthor Commented:
Thanks a lot, sorry for the delayed response, have been ill for the past couple of days!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.