Order by in Editor's class

Order by in Editor's class

borconiborconi Posts: 56Questions: 19Answers: 1

For the first time I needed to use the order by sql since I wanted to return the data from the database already ordered, to my huge surprise I wasn't able to find anything about it. I looked at the Editor class and it doesn't have a function for this....

May I ask why? Is there a reason I'm missing....

Replies

  • borconiborconi Posts: 56Questions: 19Answers: 1

    @tangerine thanks for that, well I see the point but I'm not 100% convinced there isn't any benefit to it. In cases of large datatables which we want to load sorted by whatever, it will be more efficient if the SQL server does the sorting rather than dumping all the data and let the client go through it. Sure for a few row's it makes no difference for big tables with 10k+ rows.
    You could turn around and say use server side processing, well then you are going to hammer the server for every consecutive manipulation of the table (filter, sort, etc) again not ideal in some cases, but might work very well in other cases.

    My point is that I do believe there is a scope for having an OrderBy function as well.... but if the overwhelming judgment is that isn't a need I'm willing to accept that.

  • rf1234rf1234 Posts: 2,809Questions: 85Answers: 406
    edited March 2018

    Just create a view of your table(s) that is taylor made for what you need. That should help you out. You may require that your view is updatable which seems to be the standard for MySql; just tested it with one of my views and it worked. Don't know about SQL server. Maybe you'll find a hint here: https://datatables.net/forums/discussion/35465

  • borconiborconi Posts: 56Questions: 19Answers: 1

    @rf1234 - Totally forgot about View's :smile: that will do (for now since it's only one table I'm talking about)

This discussion has been closed.