Bootstraptable: take the data-index by the Row obtained by the getSelections method

Asked

Viewed 86 times

0

I have a table in my project where I use the plugin Boostraptable, which has a column with radio button enabled (data-radio="true").

To recover the data from the record marked in the table via javascript use the method $(tabela).bootstrapTable('getSelections') and get the selected "Row".

However, how do I get the value of the data-index attribute (generated by the plugin itself)?

(need the data-index so that at another time I can mark the radiobutton again)

  • Strange, I read the documentation of the link there, and I did not find this data-index.

  • The table row index that he always cites in the documentation is saved in an attribute created by the plugin itself called "data-index", in the <tr> tag (some other tags may have this attribute tb). But I already managed to find a solution to my problem, I let down.

1 answer

1


Got it, went straight through the DOM using jQuery, without using a plugin method, to recover the line index:

$(table input[name='btSelectItem']:checked"). attr("data-index")

Browser other questions tagged

You are not signed in. Login or sign up in order to post.