Chumper / Datatable

This is a laravel 4 package for the server and client side of datatables at http://datatables.net/
https://github.com/Chumper/Datatable
388 stars 154 forks source link

[develop] can't use function names as callbacks #338

Open Javier-Rotelli opened 9 years ago

Javier-Rotelli commented 9 years ago

if you use a function name as a callback, it gets escaped as a string. Expected

$table->setCallbacks(['fnDraw'=>'myFnDraw']);

should generate:

{
    fnDraw: myFnDraw
}

current

{
    fnDraw: "myFnDraw"
}

this is because the options and the callback get merged and treated equally.
here: https://github.com/Chumper/Datatable/blob/develop/src/Chumper/Datatable/Table.php#L299 and here: https://github.com/Chumper/Datatable/blob/develop/src/Chumper/Datatable/Table.php#L372