tableTools/editor buttons - trigger triple row selection

tableTools/editor buttons - trigger triple row selection

tom@pdptom@pdp Posts: 19Questions: 7Answers: 0

Hi,

I need to load additional data based on the row selected in the table. For this purpose I added the checkboxes at the beginning of each row to select a single row, where columns: [data: ... class:"col"...]. I found out how to check if the same row was selected or "unselected" by comparing aData['id'] and tmp_id that has previous selected id, and 3 or 4 other flags (like select_all, select_none, etc.) in
fnRowCallback: function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) { $('td.col', nRow).on( "mouseup", function() {}); }.

It works perfect until I start using tableTools or editor buttons. After, I click on the edit->update or print preview->esc buttons and select another row, I start getting the indication in the console that $('td.col', nRow).on( "mouseup", function() { });was triggered 3 times, and it continues this way until I refresh the page. This messes up my tmp_id and instead of receiving row selected I get row "unselected" , and opposite. Is there any other way to know the status of the rows, AFTER each row selection (like selected, "unselected", selected all, or selected more than one row) and/or how do deal with this issue that I've described above?

Thanks in advance

Answers

  • tom@pdptom@pdp Posts: 19Questions: 7Answers: 0

    Eventually, I've got a few extra minutes to go back to this issue.
    $("#users tbody").click(function(event) {...aData['id']...}); returns the actual index of a selected row because it activates when the row is already selected. It means that I don't need all the flags anymore. Strangely enough, $('td.col', nRow).on( "mouseup", function() {...aData['id']...}); activates before the row is selected, and always returns the previous index.

    With all that, after I click on a editor button, even while using $("#users tbody").click(function(event) {...aData['id']...});, the debugger enters there 3 times more than it was when I just loaded the page. I guess, the issue is still there.

This discussion has been closed.