nova-belongsto-depend
nova-belongsto-depend copied to clipboard
Ajax async searchable don't works
NovaBelongsToDepend::make(__('Organization'), 'organization', Organization::class)
->placeholder('Optional Placeholder')
->searchable(),
I get empty list and search don't work.
I can't use ->options(\App\Organization::all() )
because I have 10 000+ organizations.
Rendering all list items slows down the browser.
Does anybody know what the status is, for this issue. I too will soon have an issue, where it's not feasible to use options()
the way that it's currently implemented. Especially, when you expect +10.000 results to be returned.
+1 for me. same issue. to many rows
Still no searchable()
support?
Feel free to make a PR. I will merge ist :)
Fair point. Then, is there maybe an option for this component to depend on a standard Nova BelongsTo
field?
The performance problem with NovaBelongsToDepend->options()
is the following:
List view
In the list view, for each field in each row, the field's meta data are returned from the server (via NovaBelongsToDepend::meta()
).
When using NovaBelongsToDepend->options()
, all of the options are included in the meta data.
So when 25 rows are displayed in the list view, and each row has a single NovaBelongsToDepend field with 100 options, 2500 option arrays are included in the response.
Detail + edit view
When viewing the details or editing a record, all the options are returned with the meta data as well. Having 10.000 or even 100.000 entries slows down browsers considerably.
Possible workarounds and solutions
A workaround would be to use optionsResolve
instead of options
, but this does not work when editing a record: When clicking on the non-dependent NovaBelongsToDepend, only "List is empty" is shown.
Another solution could be to only include the options
key in the meta data when editing a record, not when simply displaying it.