Major breakthrough : I've got ColumnFilterWidgets working with server-side processing (sqlsvr in my case).
In order to do this, I've had to run a prefetch of the distinct column data.
First of all, I've made a generic, reusable function to build up a datatable in php.
This is of course unnecessary, but since I'm posting my script, I'm explaining what I've done.
This function is called with the proper parameters
$columns is an array of the column name strings
$indexcolumn is the index column name string
$column headers is an array of header name strings (thead & tfoot)
$cookie is a targetcookie string in 'c[s]' form. Selected rows are saved as a cookie array to use elsewhere (in queries).
$excludeWidgets is an array of column index integers.
$invisible is an array of column index integers.
The datatable function is on a separate page, which I php-include.
I'm not going to explain the following functions (which are included elsewhere) unless u want me to:
- (php) QueryDatabase -> fetches a 2d array from the db.
- (js) BoolCookie and the (php) Cookie class -> toggles a value in a cookie array.
the $cookie is of the form 'cookie_arr[cookiesub]' with a '?' delimiter.
In the first part, I build up the prefetch query in the $s variable.
This is the key to get ColumnFilterWidgets working server-side.
It's pretty fast. I believe it should also work with MySQL but I'm not sure.
If needed I'll work that one out.
I'm adding this result as a property of oColumnFilterWidgets
In order to do this, I've had to run a prefetch of the distinct column data.
First of all, I've made a generic, reusable function to build up a datatable in php.
This is of course unnecessary, but since I'm posting my script, I'm explaining what I've done.
This function is called with the proper parameters
$columns is an array of the column name strings
$indexcolumn is the index column name string
$column headers is an array of header name strings (thead & tfoot)
$cookie is a targetcookie string in 'c[s]' form. Selected rows are saved as a cookie array to use elsewhere (in queries).
$excludeWidgets is an array of column index integers.
$invisible is an array of column index integers.
datatable ($query,$columns,$indexcolumn,$columnheaders,$cookie,$excludeWidgets,$invisible);my base table is a query, so to just run it on one table or one view, you'll have to set
$query= " select a,b,c from yourtable ";
The datatable function is on a separate page, which I php-include.
I'm not going to explain the following functions (which are included elsewhere) unless u want me to:
- (php) QueryDatabase -> fetches a 2d array from the db.
- (js) BoolCookie and the (php) Cookie class -> toggles a value in a cookie array.
the $cookie is of the form 'cookie_arr[cookiesub]' with a '?' delimiter.
In the first part, I build up the prefetch query in the $s variable.
This is the key to get ColumnFilterWidgets working server-side.
It's pretty fast. I believe it should also work with MySQL but I'm not sure.
If needed I'll work that one out.
I'm adding this result as a property of oColumnFilterWidgets
$r.=' ,"oColumnFilterWidgets": { '; $r.=' "trueData": '.json_encode($cfw).' }';