Checkbox attribute #645
Answered
by
dansysanalyst
musumbidenis
asked this question in
Q&A
-
I have noticed that PowerGrid's uses the "id" attribute to fetch selected rows. How can I change that to my table's primary key such that I can export data for selected rows only |
Beta Was this translation helpful? Give feedback.
Answered by
dansysanalyst
Oct 3, 2022
Replies: 1 comment 1 reply
-
Hi @musumbidenis, You must specify the primary key, read more here and set your "id" in the showCheckBox method. The documentation needs some clarification on this. For example, I have created a database table Schema::create('restaurants', function (Blueprint $table) {
$table->id('restaurant_id');
$table->string('name');
$table->timestamps();
}); This is how my PowerGrid table looks like: <?php
final class RestaurantTable extends PowerGridComponent
{
use ActionButton;
public string $primaryKey = 'restaurants.restaurant_id';
public string $sortField = 'restaurants.restaurant_id';
public function setUp(): array
{
$this->showCheckBox('restaurant_id');
//.... |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
dansysanalyst
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @musumbidenis,
You must specify the primary key, read more here and set your "id" in the showCheckBox method.
The documentation needs some clarification on this.
For example, I have created a database table
restaurants
with the idrestaurant_id
.This is how my PowerGrid table looks like: