relation chunk default to everything? #2270
-
Creating an edit screen for a table that has several foreign keys. For instance, an organisation can be based in one of 64 districts. I created a 'Relation' field to select the district and all good except only 10 of the districts displayed. This is because Relation.chunk defaults to 10. If I add a call to chunk as below
then I get all districts (with a bit of head room in case I add one or two more) Anyway, maybe I am just missing something but wouldn't it be better for Relation.chunk to default to ALL somehow? Or is there some clever way of making it default to ALL? It seems counter-intuitive to have to work out how many records are in each dataset and set chunk accordingly. Would love to hear Thanks you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
If you need to show all the data at once, and not take it in parts, then it's best to use the Select::make('organisation.district')
->title('District')
->fromModel(District::class, 'district_name') The |
Beta Was this translation helpful? Give feedback.
If you need to show all the data at once, and not take it in parts, then it's best to use the
Select
field:The
Relation
field is specially made to load data in small portions for tables with very large records.