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
wyChoong
wyChoong2y ago
Reverse it to Types -> Providers
Mark Chaney
Mark ChaneyOP2y ago
@wychoong reverse what? Are you talking about simply changing the tables sorting?
wyChoong
wyChoong2y ago
I got you wrong. I thought you having relationmanager If is single table, maybe only allow selection after filter
nerdroid
nerdroid2y ago
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
awcodes
awcodes2y ago
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.
Mark Chaney
Mark ChaneyOP2y ago
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
awcodes
awcodes2y ago
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.
Mark Chaney
Mark ChaneyOP2y ago
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
Want results from more Discord servers?
Add your server