Open ratbek opened 5 years ago
Remove the 'edit' key from the $buttonsToGenerate
array
On Wed, Sep 19, 2018 at 11:27 AM ratbek notifications@github.com wrote:
I wrote a code to make custom row button below:
public function configureButtons() { $this->makeCustomButton([ 'name' => 'Edit', 'icon' => 'fa-eye', 'position' => 1, 'class' => 'btn btn-outline-primary btn-sm grid-row-button', 'showModal' => false, 'gridId' => $this->getId(), 'title' => 'edit record', 'url' => function() { return route('abacus.edit'); }, ], static::$TYPE_ROW); }
But I got an error "Undefined index: Edit" in makeCustomButton() function
protected function makeCustomButton(array $properties, $position = null): GenericButton { $key = $properties['name'] ?? 'unknown'; $position = $position ?? static::$TYPE_TOOLBAR; if ($position === static::$TYPE_TOOLBAR) { $this->addToolbarButton($key, new GenericButton(array_merge($properties, ['type' => $position]))); } else { $this->addRowButton($key, new GenericButton(array_merge($properties, ['type' => $position]))); }
return $this->buttons[$position][$key]; // <--- here an error occurs, undefined $key }
Also I added "Edit" to $buttonsToGenerate field
protected $buttonsToGenerate = [ 'create', 'view', 'edit', // <-- here 'delete', 'refresh', ];
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/leantony/laravel-grid/issues/85, or mute the thread https://github.com/notifications/unsubscribe-auth/AHmSKNQepdyhWEJHFEKAva0KaY3gAJM4ks5ucgAGgaJpZM4WvqZz .
https://github.com/leantony/laravel-grid/blob/master/docs/buttons.md#adding-buttons-with-urls-dependent-on-the-data-items https://github.com/leantony/laravel-grid/blob/master/docs/buttons.md#adding-custom-buttons
On Thu, Sep 20, 2018 at 10:36 AM Antony Chacha chachaantony@gmail.com wrote:
Remove the 'edit' key from the
$buttonsToGenerate
arrayOn Wed, Sep 19, 2018 at 11:27 AM ratbek notifications@github.com wrote:
I wrote a code to make custom row button below:
public function configureButtons() { $this->makeCustomButton([ 'name' => 'Edit', 'icon' => 'fa-eye', 'position' => 1, 'class' => 'btn btn-outline-primary btn-sm grid-row-button', 'showModal' => false, 'gridId' => $this->getId(), 'title' => 'edit record', 'url' => function() { return route('abacus.edit'); }, ], static::$TYPE_ROW); }
But I got an error "Undefined index: Edit" in makeCustomButton() function
protected function makeCustomButton(array $properties, $position = null): GenericButton { $key = $properties['name'] ?? 'unknown'; $position = $position ?? static::$TYPE_TOOLBAR; if ($position === static::$TYPE_TOOLBAR) { $this->addToolbarButton($key, new GenericButton(array_merge($properties, ['type' => $position]))); } else { $this->addRowButton($key, new GenericButton(array_merge($properties, ['type' => $position]))); }
return $this->buttons[$position][$key]; // <--- here an error occurs, undefined $key }
Also I added "Edit" to $buttonsToGenerate field
protected $buttonsToGenerate = [ 'create', 'view', 'edit', // <-- here 'delete', 'refresh', ];
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/leantony/laravel-grid/issues/85, or mute the thread https://github.com/notifications/unsubscribe-auth/AHmSKNQepdyhWEJHFEKAva0KaY3gAJM4ks5ucgAGgaJpZM4WvqZz .
I tried to remove, but it still doesn't work.
I tried to remove, but it still doesn't work.
Hi ratbek, if you still have interest, you should define rednderIf property of the button as callback
I tried to remove, but it still doesn't work.
Hi ratbek, Did you resolve this issue? I'm also facing the same.
Hi shahidiqbal12. No, I didn't. At the moment, I don't use this grid view.
Hi shahidiqbal12. No, I didn't. At the moment, I don't use this grid view.
Thanks @ratbek
I wrote a code to make custom row button below:
But I got an error "Undefined index: Edit" in makeCustomButton() function
Also I added "Edit" to $buttonsToGenerate field