Keep the last selected row in a factory

@lorenzofox3 I found a workaround using factories. Tests passed, and it solves https://github.com/lorenzofox3/Smart-Table/issues/255, but I'm not very proud of the implementation... 

Let me know what you think. I'll get back to it once I have more time!