1
I’m using a component called datatables.js (https://www.datatables.net/) to display my tables and it owns the property Serverside, that I call, in Ajax, my list from somewhere. It sends the ordering, felt by parameters. It sends the Index of the column to be ordered. My query is like this:
var test1 = (from x in Context.MyTable
where (x.codigo_empresa == User.EnterpriseId
&& (filtro.DataInicial == DateTime.MinValue || x.Vencimento >= filtro.DataInicial)
&& (filtro.DataFinal == DateTime.MinValue || x.Vencimento <= filtro.DataFinal)
&& (filtro.Status == 0 || x.Status == filtro.Status))
select (new
{
Status = (EnumContas.Status)x.Status,
Vencimento = x.Vencimento ?? DateTime.MinValue,
Valor = x.Valor,
id = x.Id,
IdConta = x.IdConta
}));
I need to sort it according to the column index that comes by parameters (assuming my select is in the order in which the columns will be displayed).
Any idea how to do that?
Thank you very much. I didn’t exactly use the code you sent me, but it helped me a lot in how to do.
– Salatiel