Skip to content
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

[Datatables] Hide columns based on ajax propery #92

Open
thracefields opened this issue Jun 26, 2023 · 0 comments
Open

[Datatables] Hide columns based on ajax propery #92

thracefields opened this issue Jun 26, 2023 · 0 comments

Comments

@thracefields
Copy link

Hello. Let's say for example that i have a file InvoicesDatatables.php
`<?php

namespace App\Datatables;

use App\Models\Company;
use App\Models\Currency;
use App\Models\Invoice;
use App\Models\Country;
use Illuminate\Contracts\Database\Eloquent\Builder;
use Sebastienheyd\Boilerplate\Datatables\Button;
use Sebastienheyd\Boilerplate\Datatables\Column;
use Sebastienheyd\Boilerplate\Datatables\Datatable;

class InvoicesDatatable extends Datatable
{
public $slug = 'invoices';

public function datasource()
{
 //
}

public function setUp()
{
 //
}

public function columns(): array
{
    $columns = [];

  $column[] = Column::add('id')...

  if(request()->post('showMine'))
      $column[] = Column::add('name')...
   }
    return $columns;
}

}`

I'm trying to hide a column based on ajax property but it doesn't work. I recieve error 'column x not found'.
How can I solve that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant