Kinetic App Studio - Access current row index of data view?

Does anyone know if it’s possible to access the current row of a data view? I’d like to give the user the ability to cycle through rows from a slide out panel when view details. I’ve tried debugging with a dialog an {DataViewName.viewRow} (found when inspecting the dataview object in the developer console), but it seems I can’t access arbitrary properties like this.

Or perhaps a better question would be: Is there any documentation detailing the accessible properties on a dataview? Is it just the columns? Or are there any helpful methods or properties we can use? Total rows? Current row? etc, etc.

Alright, this is unlikely to be an official long term method, but I found that you can use the #_ _# tags to denote that the value field contains Javascript. This Javascript appears to be run with a scope that grants access to the trans object. This object has many useful methods on it, such as dataView.

For my use case, I was attempting to create “Prev Row” and “Next Row” buttons on a slide out panel. These buttons allow the user to cycle through their grid result details without needing to close the slide out and select the next row. For instance:

This is accomplished within the onClick event of the next and previous buttons and the row-current-set action. In row-current-set’s parameters, specify the data view you’re cycling through and enter the following inn the Row parameter:
#_(trans.dataView('SubAssemblyView').row < trans.dataView('SubAssemblyView').count - 1) ? trans.dataView('SubAssemblyView').row + 1 : trans.dataView('SubAssemblyView').row_#
This code will increase increase the row number in the specified dataview. If you are already on the last row, it will simply return the last row again, ensuring you don’t go out of bounds.

For the previous button, create another onClick event with the row-current-set action and specify the opposite:
#_(trans.dataView('SubAssemblyView').row > 0) ? trans.dataView('SubAssemblyView').row - 1 : 0_#
This one is a bit simpler since you’re just checking to see if you’re already at index 0.

If anyone know if properties like row and count are available without resorting to Javascript, I’d love to hear.

6 Likes

Love this. I’m using row-current-set too but how do I use a condition here instead of just adding a row? #trans.dataView(‘SubAssemblyView’).row + 1# allows me to to go to the next row, but I’d like to check a condition like if the column Name of that row = ‘XYZ’, then I want to go that row?