Search code examples
javascriptjquerytwitter-bootstrapbootstrap-table

Get selections for multiple BootstrapTable tables


i'm using wenzhixin bootstrap table, and I have a lot of tables in the same page and one button, and when the button is clicked i want to gather all the selected rows from all the different tables.

so, in my JS code i did: (Ids is an array with all the tables IDs)

for (var i = 0; i < Ids.length; i++)
{
    var domain = $.map($('#' + Ids[i] + '').bootstrapTable('getSelections'), function (row)
    {
        // do something with row object...
    });
}

but it's not working... please help!


Solution

  • it was my mistake, as some of the id's contain a vertical bar character | and it is not a valid character for id in JavaScript. the $.map function returned an error because of the id with the vertical bar.