You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+45-1Lines changed: 45 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,12 @@ This library requires **DataTables 1.10 >**
19
19
20
20
* Drastically Reduces PHP Code Necessary To Generate a Server Side Table
21
21
22
+
Chnage Log
23
+
-----
24
+
***v1.1**
25
+
* New Method `setPreResultCallback(function())`
26
+
* New Method `setColumnSearchType(colName, type)` / `getColumnSearchType(colName)`
27
+
22
28
Install
23
29
-----
24
30
@@ -54,9 +60,47 @@ Name | Description | Return
54
60
`joinArray` | Join additional tables for DataTable columns to reference. *Tip: Join Types CAN be specifed by using a pipe in the key value `'table_to_join b|left outer'`*| **Assoc. Array***Key*=Table To Join *Value*=SQL Join Expression.
55
61
`whereClauseArray`| Append Static SQL to the generated Where Clause| **Assoc. Array***Key*= Column Name *Value*=Value To Filter **OR***NULL*
56
62
63
+
Methods
64
+
----
65
+
`setPreResultCallback(function)`
66
+
This will get called after the library constructs the associative array that will get converted into JSON. This allows for the manipulation of the data
67
+
in the JSON or to add custom properties to the JSON before it is pushed to the browser. Make sure that you use the & when getting the data rows, otherwise,
68
+
you will end up with a copy of the array and it will not affect the json. Below is an example of how it is used.
69
+
```php
70
+
$this -> datatable -> setPreResultCallback(
71
+
function(&$json) {
72
+
$rows =& $json['data'];
73
+
foreach($rows as &$r) {
74
+
// example of nested object in row when the
75
+
// data propterty in the javascript looks like "$.url"
76
+
if(empty($r['$']['url']) === FALSE) {
77
+
$newUrl = 'http://www.changeurl.com';
78
+
$r['$']['url'] = $newUrl;
79
+
}
80
+
81
+
// change the value of the gender in the Json. data property in the javascript looks like "gender"
0 commit comments