Search code examples
javascripttwitter-bootstrapbootstrap-table

Boostrap Table: get the row data by row index


In Bootstrap Table , one field has anchor tag, so when clicked i can get the data-index of parent row. Now i want to get the complete row data using the data-index

  $(document).on('click', '.delete_icon', function(event) {
    var index = $(this).parent().parent().data('index');
    //Get the complete row data by using the dataindex
    // Row has three fields

  });

I cannot use data-uniqueid to get the data since my unique id is String like #1:1, #1:2 etc


Solution

  • you can obtain the row, index and data of the table with a click.

    window.actionEvents = {
       'click .dele_icon': function (e, value, row, index) {
          alert('You click remove icon, row: ' + JSON.stringify(row));
          console.log(value, row, index);
       }
    };
    

    http://jsfiddle.net/wenyi/e3nk137y/39/