christianbach / tablesorter

Flexible client-side table sorting
MIT License
1.03k stars 494 forks source link

Why in bootstrap dialog the tablesorter don't work fine #102

Open oscaroxy opened 8 years ago

oscaroxy commented 8 years ago

in bootstrap the dialog is created once, so when I show the dialog I load the datas and I insert rows into table, create tablesorter ($table.tablesorter()), anything it's right. When hide/close dialog and after I re-show the dialog then I reload the datas (that is I reinsert into table the rows) recreate tablesorter on the new rows ($table.tablesorter()). When I click the header in order to sort the rows then in the table I see added the older rows with new rows... If I close dialog and re-show dialog (3th time) and click on header then in the table I see triple rows, and so on...

thanks

philgyford commented 8 years ago

I don't fully understand your problem (what dialog are you talking about?). But if you're loading new data into your table you might want to look at this example: http://tablesorter.com/docs/example-empty-table.html

You'll need to do $('#your-table').trigger('update'); when you've added new rows... although the sorting seems to change back to the default...