Datatables AJAX Directives

This datatables directive is more targeted for AJAX use. This is why sajaxsource and mdata are always required. If this is not what you are looking for, take a look at this directive. I encourage you to look at the source of this page - it is commented and the directive should be simple enough to understand :)

Example 1 - Simple

First, take a look at this json file. In this example, all you need is to declare sAjaxSource, and each mData for the columns. sAjaxDataProp is necesary to tell datatables which key it should take its data from. In this example, the key is "result". Other columns options: sclass and bvisible. You can consult the datatables reference here.

ID Name About me Phone Email Age

Example 2 - with column callbacks and options from controller

In this example, most of the options are declared in the controller. All that is needed is the mData for each column. On the ID and about cols, there's a function name. This will become $scope.idCB() and $scope.aboutCB() respectively. In this example, there's a label badge on the ID and the about text is truncated.

ID Name About me Phone Email Age