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

Laravel Yajra with barcode #3192

Open
markplus opened this issue Nov 12, 2024 · 2 comments
Open

Laravel Yajra with barcode #3192

markplus opened this issue Nov 12, 2024 · 2 comments

Comments

@markplus
Copy link

Summary of problem or feature request

I would like to add a barcode with the data of the table row, but I am in difficulty because I have never done with laravel yajra datatable html serverside. Any ideas, can anyone give me some advice on how to integrate a barcode in the table

Code snippet of problem

public function dataTable(QueryBuilder $query): EloquentDataTable
    {
        return (new EloquentDataTable($query))
            ->setRowId('id')
			->addColumn();
    }

public function getColumns(): array
    {
        return [
            Column::make('BarCode')->addClass(''),
        ];
    }

<div class="d-flex justify-content-center">
   {!! DNS1D::getBarcodeHTML($product['product_code'], "C128",1.4,22) !!}
</div>
 <hr>
<div class="d-flex justify-content-center">
  {!! DNS2D::getBarcodeHTML($product['product_code'], 'QRCODE') !!}
</div>

System details

  • Linux
  • PHP Version 8.2.15
  • Laravel Version 10.10
  • Laravel-Datatables Version 10.1
@yajra
Copy link
Owner

yajra commented Nov 14, 2024

Use add column then set it as rawColumns:

->addColumn('barcode', fn(Product $product) => DNS2D::getBarcodeHTML($product['product_code'], 'QRCODE'));
->rawColumns(['barcode'])

@markplus
Copy link
Author

Use add column then set it as rawColumns:

->addColumn('barcode', fn(Product $product) => DNS2D::getBarcodeHTML($product['product_code'], 'QRCODE'));
->rawColumns(['barcode'])

Thank you very much for the answer, if I wanted a print button only for the generated barcode is it possible to do it?
I should print the barcode with a dymo

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

2 participants