I do similar, https://drive.google.com/file/d/0B1_PFw--3o74YjVreHNBOWU2aEE/view but not datatables.
But still it would be a different query. I use query scopes in the model, or if desired you can in controller. I just like my queries in model so I can use scopes.
I like writing my own html tables.