using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace jQuery.DataTables.Mvc
{
///
/// Represents the required data for a response from a request by DataTables.
///
///
public class JQueryDataTablesResponse
{
public JQueryDataTablesResponse(IEnumerable items,
int totalRecords,
int totalDisplayRecords,
int sEcho,
ReadOnlyCollection sSearch_)
{
aaData = items;
iTotalRecords = totalRecords;
iTotalDisplayRecords = totalDisplayRecords;
this.sEcho = sEcho;
this.sSearch_ = sSearch_;
}
public JQueryDataTablesResponse(IEnumerable items,
int totalRecords,
int totalDisplayRecords,
int sEcho)
{
aaData = items;
iTotalRecords = totalRecords;
iTotalDisplayRecords = totalDisplayRecords;
this.sEcho = sEcho;
}
///
/// Sets the Total records, before filtering (i.e. the total number of records in the database)
///
public int iTotalRecords { get; private set; }
///
/// Sets the Total records, after filtering
/// (i.e. the total number of records after filtering has been applied -
/// not just the number of records being returned in this result set)
///
public int iTotalDisplayRecords { get; private set; }
///
/// Sets an unaltered copy of sEcho sent from the client side. This parameter will change with each
/// draw (it is basically a draw count) - so it is important that this is implemented.
/// Note that it strongly recommended for security reasons that you 'cast' this parameter to an
/// integer in order to prevent Cross Site Scripting (XSS) attacks.
///
public int sEcho { get; private set; }
///
/// Sets the data in a 2D array (Array of JSON objects). Note that you can change the name of this
/// parameter with sAjaxDataProp.
///
public IEnumerable aaData { get; private set; }
public ReadOnlyCollection sSearch_ { get; private set; }
}
}