最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - Boostrap Table: get the row data by row index - Stack Overflow

matteradmin5PV0评论

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 plete row data using the data-index

  $(document).on('click', '.delete_icon', function(event) {
    var index = $(this).parent().parent().data('index');
    //Get the plete 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

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 plete row data using the data-index

  $(document).on('click', '.delete_icon', function(event) {
    var index = $(this).parent().parent().data('index');
    //Get the plete 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

Share Improve this question asked Feb 15, 2016 at 14:22 mondamonda 3,91516 gold badges61 silver badges85 bronze badges 1
  • could you provide HTML markup? – johannesMatevosyan Commented Feb 15, 2016 at 14:38
Add a ment  | 

1 Answer 1

Reset to default 3

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/wenyi/e3nk137y/39/

Post a comment

comment list (0)

  1. No comments so far