Table Line Relative Position

0
  • I have a table with 50 lines
  • Of these only 10 are visible
  • Added class css "ux-select" line 5

The code $('table tbody tr:visible.ux-select').index() will tell me what line number in the context of the table as a whole (return 5)

Question: How do I get the relative position of this line, that is, since the table only has 10 visible lines, line 5 that has class ux-select the visible ones? (1st? 2nd? 3rd? .... No.?)

    
asked by anonymous 14.08.2017 / 21:15

1 answer

0

The logic is + - count the previous siblings that are visible.

var index = $('table tbody tr:visible.ux-select').prevAll(':visible').length + 1;

Here's an example:

link

    
14.08.2017 / 22:30