bulk select requirements
lets say you have a table with a list of Utility Providers. Those providers are associated with certain Utility Types, like Gas, Electric, etc. If I wanted to have a bulk selection option, any ideas how i might force the user to only select providers of the same type? Trying to do that validation before the bulk action form
8 Replies
Reverse it to Types -> Providers
@wychoong reverse what? Are you talking about simply changing the tables sorting?
I got you wrong. I thought you having relationmanager
If is single table, maybe only allow selection after filter
i'd say check form events. i could not find a list of events dispatched by form elements. but a little source diving might help
Does the bulk action even have all the data for the selected records to test against? I’m thinking it just has the ids, but I could be wrong.
I need to double check. It’s limited in that way with our existing app, so I need to find a way to disable selection of rows that don’t match that initial utility type. I will check how it’s currently being done
As long as more than the id is available I would think you could throw an exception about it after looping through them to make sure all the types match.
Seems like it could get buggy with large data sets though.
Like @wychoong said though it might be better to only enable it if a filter for types is set on the table. That might be the easiest solution.
Hmm, maybe I should not do bulk options and actually just do a checkboxColumn and do my logic with header action and alpine
I just have to disable it from trying to save the data right away (i know, its made for inline saving) or create a custom column
How can i disable the column label if i try creating my own checkboxes solution? ->label(null) just uses the make('foo') name and false isnt allowed per types, though it does actually hide it. There isnt a hiddenLabel() option and an empty string doesnt work either. I really think im probably going to have to create a custom column here. Id rather avoid it though.
->label(fn(): bool => false)
works