open-admin-org / open-admin

open-admin forked from z-song/laravel-ladmin. Removing jquery, now based on Bootstrap5, vanilla JS
https://open-admin.org
MIT License
240 stars 66 forks source link

Sortable not defined by default on json column #130

Open RCyrix opened 6 months ago

RCyrix commented 6 months ago

Hi there, I hope everything is well!

When using a JSON column it submits perfectly fine etc

However when calling the $form->keyValue('your_column', 'Your Column') function it gives the following error

Screenshot from 2024-01-04 11-12-36

When chaining sortable() as the following

$form->keyValue('your_column', 'Your Column')->sortable(true|false) it works 100% and renders as expected

image

Of course a null wrapper can be used on the view but I'd prefer checking whats happening on the controller, I'm gonna look into it and will revert and present what I find

RCyrix commented 6 months ago

@open-admin-org

Ok I see the 'sortable' key is handled by a trait,

My suggestion is just a coalesce handler on the options['sortable'] check

image

This sorts the error

OpenAdmin\Admin\Form\Field\Traits\Sortable