open-admin icon indicating copy to clipboard operation
open-admin copied to clipboard

Sortable not defined by default on json column

Open RCyrix opened this issue 1 year ago • 1 comments

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 avatar Jan 04 '24 09:01 RCyrix

@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

RCyrix avatar Jan 09 '24 21:01 RCyrix