-
-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
datatable: data with function, doesn't work sort #88
Comments
I made the changes more or less and it works fine. datatables/src/QueryBuilder.php Lines 88 to 99 in f5b5c32
to public function setColumnAttributes(): void
{
$columns = $this->options->columns();
if ($columns) {
foreach ($columns as $key => $attr) {
$index = $attr['data']['_'] ?? $attr['data'];
if ($index === 'function') {
$index = $key;
}
if ($this->columns->visible()->isExists($index)) {
$this->columns->visible()->get($index)->attr = $attr;
}
}
}
} datatables/src/QueryBuilder.php Lines 277 to 305 in f5b5c32
to protected function orderBy(): string
{
...
foreach ($orders as $order) {
$data = $this->options->columns()[$order['column']]['data'];
$id = $data['sort'] ?? $data['_'] ?? $data;
if ($id === 'function') {
$id = $order['column'];
}
if ($this->columns->visible()->isExists($id)) {
$o[] = $this->columns->visible()->get($id)->name.' '.$order['dir'];
}
}
...
} |
jlopes90
changed the title
datatable: data with function
datatable: data with function, doesn't work sort
Jun 27, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I use
data: function(row)
and it works but sorting doesn't work.Example:
The text was updated successfully, but these errors were encountered: