[INCORRECT DOCS] backwards docs on event.row and event.rowIndex 8.1.33

Hey guys, I was messing with the table event configurations and I ran into some backwards documentation on the onRowClick event object. The row and RowIndex have flipped functionality as to what the docs say. the event.row object refers to the index of the filtered data, while the rowIndex refers to the index of all the rows in the table.

The docs have this mixed up.

2 Likes

That's not how it's working on my end.
I have this script:

def runAction(self, event):
	from pprint import pformat
	system.perspective.print("click " + pformat(event))

And the default table, filtered like this:

As I click between rows this is what I get:

10:09:00.523 [Browser Thread: 1a28b64e-6d05-4713-9dcf-48ba145154f9] INFO Perspective.Designer.Workspace - click {u'row': 0L, u'rowIndex': 0L, u'value': {u'city': 'Folsom', u'country': 'United States', u'population': 77271L}}
10:09:03.799 [Browser Thread: 1a28b64e-6d05-4713-9dcf-48ba145154f9] INFO Perspective.Designer.Workspace - click {u'row': 1L, u'rowIndex': 1L, u'value': {u'city': 'Helsinki', u'country': 'Finland', u'population': 635591L}}
10:09:05.639 [Browser Thread: 1a28b64e-6d05-4713-9dcf-48ba145154f9] INFO Perspective.Designer.Workspace - click {u'row': 6L, u'rowIndex': 2L, u'value': {u'city': 'San Francisco', u'country': 'United States', u'population': 884363L}}
10:09:05.789 [Browser Thread: 1a28b64e-6d05-4713-9dcf-48ba145154f9] INFO Perspective.Designer.Workspace - click {u'row': 6L, u'rowIndex': 2L, u'value': {u'city': 'San Francisco', u'country': 'United States', u'population': 884363L}}
10:09:05.790 [Browser Thread: 1a28b64e-6d05-4713-9dcf-48ba145154f9] INFO Perspective.Designer.Workspace - dbl {u'row': 6L, u'rowIndex': 2L, u'value': {u'city': 'San Francisco', u'country': 'United States', u'population': 884363L}}
10:09:18.943 [Browser Thread: 1a28b64e-6d05-4713-9dcf-48ba145154f9] INFO Perspective.Designer.Workspace - click {u'row': 33L, u'rowIndex': 3L, u'value': {u'city': 'Kabul', u'country': 'Afghanistan', u'population': 3414100L}}
10:09:25.890 [Browser Thread: 1a28b64e-6d05-4713-9dcf-48ba145154f9] INFO Perspective.Designer.Workspace - click {u'row': 42L, u'rowIndex': 4L, u'value': {u'city': 'Paris', u'country': 'France', u'population': 2229621L}}
10:09:31.254 [Browser Thread: 1a28b64e-6d05-4713-9dcf-48ba145154f9] INFO Perspective.Designer.Workspace - click {u'row': 42L, u'rowIndex': 4L, u'value': {u'city': 'Paris', u'country': 'France', u'population': 2229621L}}
10:09:31.401 [Browser Thread: 1a28b64e-6d05-4713-9dcf-48ba145154f9] INFO Perspective.Designer.Workspace - dbl {u'row': 42L, u'rowIndex': 4L, u'value': {u'city': 'Paris', u'country': 'France', u'population': 2229621L}}
10:09:31.401 [Browser Thread: 1a28b64e-6d05-4713-9dcf-48ba145154f9] INFO Perspective.Designer.Workspace - click {u'row': 42L, u'rowIndex': 4L, u'value': {u'city': 'Paris', u'country': 'France', u'population': 2229621L}}

Where rowIndex is 'within the visible rows', and row is 'within the table's overall data', which is what the documentation (and the autocomplete) suggests:

This is on 8.1.34, basically; are you on an older version? It's possible we fixed a bug here.

1 Like

Paul,

It's possible that I came to the wrong conclusion when it comes to a separate scripting function that has to do with the Table.

I was trying to use the .expandSubviews() function and I assumed (for whatever reason) that the function required the row index of the filtered table, and not the row index of the full table.

I'm not sure what made me think that, but that is where I went astray on this one. Looks like you pass the full table index to the expand and collapse functions.

Sorry for the confusion.

1 Like

I guess it was this comment that made me think that.

I'm not sure where to find the actual docs for that scripting function.

1 Like

It's here.

1 Like