Datatables: Cannot read property ‘mData’ of undefined

FYI dataTables requires a well formed table. It must contain <thead> and <tbody> tags, otherwise it throws this error. Also check to make sure all your rows including header row have the same number of columns. The following will throw error (no <thead> and <tbody> tags) <table id=”sample-table”> <tr> <th>title-1</th> <th>title-2</th> </tr> <tr> <td>data-1</td> <td>data-2</td> … Read more

How to manually update datatables table with new JSON data

SOLUTION: (Notice: this solution is for datatables version 1.10.4 (at the moment) not legacy version). CLARIFICATION Per the API documentation (1.10.15), the API can be accessed three ways: The modern definition of DataTables (upper camel case): var datatable = $( selector ).DataTable(); The legacy definition of DataTables (lower camel case): var datatable = $( selector … Read more

How to join two tables with ssp.class.php

As PaulF pointed out, you need to use JOIN or sub-query to retrieve father’s name from the same table. I assume you’re using ssp.class.php to process your data on the server-side based on the example you’ve mentioned. Class ssp.class.php doesn’t support joins and sub-queries, but there is a workaround. The trick is to use sub-query … Read more

jquery datatables hide column

Hide columns dynamically The previous answers are using legacy DataTables syntax. In v 1.10+, you can use column().visible(): var dt = $(‘#example’).DataTable(); //hide the first column dt.column(0).visible(false); To hide multiple columns, columns().visible() can be used: var dt = $(‘#example’).DataTable(); //hide the second and third columns dt.columns([1,2]).visible(false); Here is a Fiddle Demo. Hide columns when the … Read more

jQuery DataTables server-side processing using ASP.NET WebForms

I wrote a simple example that should illustrate the idea. Start by writing a generic handler for handling data on the server side (Data.ashx but this could be a web page, web service, anything server side script capable of returning JSON formated data): public class Data : IHttpHandler { public void ProcessRequest(HttpContext context) { // … Read more

How can i load a set number of rows from a table on pageload and only load further rows when the user loads them?

This will focus purely on the DataTables aspects of a “server-side” solution. How you write the server-side logic needed to support it is out of scope for this answer. But I hope these notes will at leasst clarify what that logic needs to be, and how you can approach it. Assumptions Assume you have a … Read more