title: Server-side paging with filtering and sorting
body: <p>In our web application we have some data-intensive UI pages that are quite slow, and the client-side sorting and filtering we're using now is forcing these pages to load all the data from the API (in JSON) and then perform the operations in the browser which usually means the page freezes for several seconds before it's ready for use.
  The solution we're looking into is to provide server-side paging with support for filtering and sorting.
  </p>
  <p>For paging, we are sending the pageIndex and pageSize parameters in the URL and it works fine. Now for sorting (and filtering) we are thinking of sending the names of the properties to sort (and filter) with inside a JSON object that can be parsed by the API to generate a proper query for the data. The problem I have here is that to make things as simple and fast as possible, the UI pages will have to “know” about the data column names according which they want to sort (or filter) data, which is not desirable.
  </p>
  <p>
  For example, the API sends users first names in a property called “FN” (in a JSON object); however, to ask the API to sort users according by first names, the UI will have to send “FirstName” as the sorting property which is the name of the column in my database. This method allows me to pass the name of the property directly to my data layer and get things done quickly. However, the need of the UI to recognize the names of the columns of the data tables in the database pretty much undoes the whole idea of separating concerns between layers (which was a major motivation for us to break down our web app into separate API and UI).
  </p>
  <p>
  Is there a clean way to provide the server-side paging with filtering and sorting without creating this dependency between the UI and the backend?
  </p>
  <p>
  Thank you.
  </p>