forked from fheider/cakephp-datatables
-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
Isn't there a small bug in the construct callback function of the plugin:
public function __construct(string $name, array $args = [])
{
if (empty($args)) {
$code = $name;
} else {
$code = 'function () { ';
foreach ($args as $a) {
$arg = json_encode($a);
$code .= "Array.prototype.push.call(arguments, {$arg});";
}
$code .= "return {$name}.apply(this, arguments); }";
}
$this->setHash($code);
}
Seems that this forces any callback function to use parameters, otherwise the construct just returns the hash of $name.
In my example I have a callback function that doesn't require any paranmters:
dt.render.foo = function (data, type, full, meta) {
....
return foobar;
}
$columns[7]['render'] = $this->DataTables->callback('foo');
This will not call the callback function so I have to do something like this to force it to work:
$columns[7]['render'] = $this->DataTables->callback('foo', [false]);
Or did I mis-understand something about how this should work?
Thanks.
Metadata
Metadata
Assignees
Labels
No labels