Bootstrap Table get the index of the clicked row

Not much to say, go directly to the code to explain.

oTab.on("click-cell.bs.table", function ($event, field, value, row, target) {
    var index = target[0].parentElement.rowIndex;
});
Pay attention to the last parameter. I don't know why the official document does not mention the fifth parameter. When I print it out, it turns out that it is the td that was clicked. By looking at its properties through this td, we can know the index of its row.

By the way, let’s spit out the official documentation of Bootstrap Table. The order of the function parameters given is not correct and incomplete. The first parameter is obviously a jquery event. Why is the parameter document written as $element. . .

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325488147&siteId=291194637