carpenter
carpenter copied to clipboard
Sorting not working
I have a Carpenter table which renders properly, but sorting takes no effect, on any column.
I can click column headers, and then the column name is included in the url's GET params. But ordering of the table's rows doesn't change, and no icon is displayed next to the header. What is more, when I click column header X, and then click it again, there is no param specifying reversed sort direction in GET params (which I think should be the case).
I use Laravel 4.2
and carpenter v1.0.4
. Carpenter config as in this issue.
I define my table using this code. Sorting doesn't work any any column.
$table->setTemplate(Config::get('app.base_path') . '/app/views/tables/management.php');
$table->column('id')->setLabel('#');
$table->column('company.name')->setLabel('Manufacturer');
$table->column('name')->setLabel('User Name');
$table->column('email');
$table->column('confirmed');
$table->column('type')->unsortable();
$table->column('created_at')->setLabel('Created');
// add presenters
$table->column('id')->presenter(function ($value, $row) {
return self::link("/management/loginAsUser/{$value}", $value);
});
$table->column('email')->presenter(function ($value, $row) {
return self::mailto($value);
});
$table->column('type')->unsortable()->presenter(function ($value, $row) {
return View::make(
'tables.manufacturer-signups-type-presenter', [
'types' => $this->types,
'company' => $row->company,
])->render();
});
$table->column('created_at')->presenter(function ($value, $row) {
return date("d-m-Y", strtotime($value));
});
and populate it like this:
Carpenter::add('manufacturers signups', ManufacturerSignupsTable::class);
$table = Carpenter::get('manufacturers signups');
$table->model(User::class)->filter(function($q) {
$q->where('company_id' , '!=', 'NULL');
});
BTW could you please fix the full docs on http://carpenter.michaeljennings.im/? It is inaccessible now
Hmm I can't seem to find the issue with this one, can you try changing to the illuminate session driver and see if that fixes the issue please?
Sorry about the bugs, I'll try to get the docs working tonight.
No, changing session driver to illuminate
didn't help. Can I give you some other information, or maybe you can describe the sorting procedure so that I can assert that the right happen (not on happen) in my project?
(you could maybe describe the inner workings of session, as the Laravel docs only cover that superficially)