Smart-Table icon indicating copy to clipboard operation
Smart-Table copied to clipboard

Any possible way to do keyboard navigation?

Open Tedko opened this issue 8 years ago • 3 comments

e.g. Select a single row and use up/down to do the navigation?

Tedko avatar Feb 05 '16 01:02 Tedko

I believe so, but I don't think is part of the scope of smart-table

lorenzofox3 avatar Feb 05 '16 11:02 lorenzofox3

+1 @Tedko did you find a way to do this?

rdehuyss avatar Mar 04 '16 14:03 rdehuyss

@Tedko @rdehuyss @lorenzofox3 - Probably a bit late but I have created a solution for this.

You could create a table navigation service which tracks the current row and exposes navigation methods to modify the current row's value and sets focus to the row.

Then all you would need to do is create a key binding directive where you could track key down events and fire the exposed methods from the table navigation service, on key up or key down.

I have used a controller to link the service methods to the key binding directive via a configuration object called 'keyDefinitions'.

You can extend the keyDefinitions to include the 'ENTER' key (Code: 13) and hook on to the selected $index value via the service property 'tableNavigationService.currentRow' or '$scope.data', then pass it as a parameter to your own custom submit() function.

I hope that this is helpful to somebody.

I have posted my solution to this issue at the following plunker location: Keyboard Navigation Service Demo

chriso86 avatar Apr 21 '16 11:04 chriso86