F
Filament3mo ago
Sector

KeyValue

Is it possible to make the KeyValue field to make the key auto incrementing? (when it's disabled)
7 Replies
LeandroFerreira
LeandroFerreira3mo ago
Could you explain more about it?
Sector
SectorOP3mo ago
Sure. I want to create a KeyValue column, where I hit the "Add row" button, the Key value goes up by 1. ( and it's dislabled ), so in this case, a new row is added, where the default key is 52.
No description
Sector
SectorOP3mo ago
Also, I can hide somehow the a Keys?
Lara Zeus
Lara Zeus3mo ago
you could customize the create action and set the input to incremented value! https://filamentphp.com/docs/3.x/forms/fields/key-value#customizing-the-key-value-action-objects
Sector
SectorOP3mo ago
and with this, how can i access the current and the previous row?
Lara Zeus
Lara Zeus3mo ago
not sure, but you can add a prop counter and then you can $this-counter++ on creating and $this->counter-- on delete
Sector
SectorOP3mo ago
i dont think i can access the values with this :S maybe i will use a mutator or something, i dont have better idea.
Want results from more Discord servers?
Add your server