Hi there. I have recently started with this framework so I might not know things. Anyway, I need some help to figure out how to do what I want.
I have a model called
HeroItem that is populated from my database. I have built a simple CRUD admin interface to edit items that belong to heroes, for example.
Question 1 - replace integer key with label
There is a field called
type which is integer – type of item such as weapon, armor, potion etc. First of all, I didn’t found how to supply values native so I have used a hack described here https://github.com/atk4/ui/issues/251#issuecomment-340202939
I used this snippet to alter the form value
$values = [
1 => 'Junk',
2 => 'Recipe',
3 => 'Quest',
4 => 'Weapon',
5 => 'Armor',
$this->getElement('type')->ui['form'] = new \atk4\ui\FormField\DropDown(['values' => $values]);
This works great for the dropdown in the form, I see the label and not the key. However it is still displayed as a numeric value in the grid. How an I solve that?
Question 2 - checkbox is not checked for boolean=true columns
On the previos screenshot item with
equipped. This is correct. But when I click on edit and see the form – it is not checked and if I save it I will lose my value. If I manually tick it it will work fine. But I often forget to do that. See screenshot below.
Thank you! Hope we can resolve it without hacking the engine. I can provide the code of my models if that is needed.