Skip to content

Requirements and limitations

Alexander Krutov edited this page Nov 24, 2016 · 8 revisions

Requirements and limitations

There are few points that you should take in account when use DataTables.Queryable:

1. columnDefs: data/name

You should specify data or/and name for each column in columnDefs section of datatables configuration:

var table = $('#table').DataTable({
    serverSide: true,
    order: [[0, "asc"]],
    pageLength: 10,
    ajax: { url: '/DataTables/GetPersons' },
    columnDefs: [
        { targets: 0, data: 'Name' },
        { targets: 1, data: 'Position' },
        { targets: 2, data: 'Office' },
        { targets: 3, data: 'Extn' },
        ...
    ]
});

2. Properties names matching

Model type used on server side should have public properties with same names as data or/and name on client side:

public class Person
{
    public string Name { get; set; }
    public string Position { get; set; }
    public string Office { get; set; }
    public int Extn { get; set; }
    ...
}

3. EF limitations

If you use custom filtering or modified search predicates features of DataTables.Queryable with Entity Framework, please remember that only limited number of expressions can be translated to SQL queries.

  • Do not use custom C# functions in predicates:
// will not work!
  • Do not use complex type conversions
// will not work!
  • Do not use regular expressions
// will not work!
Clone this wiki locally