laravel-table icon indicating copy to clipboard operation
laravel-table copied to clipboard

Assign Id to table ?

Open tayyabhussain opened this issue 8 years ago • 2 comments

How can I assign an id to a table. I am creating a table like return view('admin.booking.list', [ 'table' => \App::make('table')->create($this->getBookingManager()->getAllByAdmin()) ]);

tayyabhussain avatar Apr 21 '16 08:04 tayyabhussain

There's currently no way to do this short of creating a custom view and hard-coding the ID, like so:

$table = Table::create();
$table->setView('tables/custom_table');

// views/tables/custom_table.blade.php:
<table class="{{ $class or 'table' }}" id="assigned_id">
// ...copy the rest of the file from the default view

I will leave this issue open so that ID setting can be included in a future release.

gbrock avatar Apr 21 '16 14:04 gbrock

right now, I'm creating table this way by sending array of objects to the view.. `<?php if ($table->getRows()->count()) {

        $table->setColumns(['shop_id']);
        $table->addColumn('unhashed_password', 'Password');
        $table->addColumn('system', 'Shop System', function ($model) {
            if ($model->system) {
                return $model->system->name;
            }

            return '';
        });
   }`

tayyabhussain avatar Apr 22 '16 06:04 tayyabhussain