Sorting Server Side

Sorting Server Side

devhussdevhuss Posts: 3Questions: 0Answers: 0
edited December 2015 in Editor

I would like to apply my sorting on the server, we cannot forward the sorting through JavaScript

The following code does not work because the Row count gets the same ORDER BY clause as the select statement used to fetch the data.

SELECT  COUNT( id ) as cnt, FROM  data_relations_view  ORDER BY Rel_code  ASC 

This is the code i am currently using:

[Datatables.Editor].Where(x => {
    x.Order(sort.Column + " " + sort.Order);
});

Is there any workaround / solution available to get rid of this issue?

Replies

  • devhussdevhuss Posts: 3Questions: 0Answers: 0

     

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Could you show me a little bit more context of what you are looking to do here please. Why should the client-side not do the ordering?

    Allan

  • devhussdevhuss Posts: 3Questions: 0Answers: 0

    (Sorry for the very late reply)

    I was trying to sort serverside using webapi (as per example in http://editor.datatables.net/manual/net/webapi). However when trying to sort on multiple columns at once the generated count function threw an exception. This was when using editor Editor-1.5.3.

    I've now decided to try to store the multiple states of the data table (including sorting, column order, fitlers and visible columns) thereby allowing the user to save multiple sort clauses. These states will be saved serverside but applied clientside.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Good to hear that you've got it working the way you need.

    I think in general the Editor .NET classes aren't really designed in such a way that the order can be specified server-side (that wasn't something I had thought of certainly). The order typically comes form the client-side.

    Allan

This discussion has been closed.