Skip to content

Should display dynamic options for checkbox list#6935

Merged
danharrin merged 2 commits into
filamentphp:2.xfrom
juliomotol:fix/should-display-dynamic-options-for-checkbox-list
Jul 6, 2023
Merged

Should display dynamic options for checkbox list#6935
danharrin merged 2 commits into
filamentphp:2.xfrom
juliomotol:fix/should-display-dynamic-options-for-checkbox-list

Conversation

@juliomotol
Copy link
Copy Markdown
Contributor

  • Changes have been thoroughly tested to not break existing functionality.
  • New functionality has been documented or existing documentation has been updated to reflect changes.
  • Visual changes are explained in the PR description using a screenshot/recording of before and after.

This PR aims to fix displaying dynamic options for CheckboxList.

Given the ff:

Forms\Components\CheckboxList::make('states')
    ->options(
        fn (Closure $get) => ($country = $get('country'))
            ? State::whereCountryId($country)->pluck('name', 'id')
            : []
    )

Prior to this PR, the options are not displayed but is available in the DOM.

The proposed solution is to call updateVisibleCheckboxListOptions() in the 'message.processed' hook.

Signed-off-by: Julio Motol <julio.motol89@gmail.com>
@what-the-diff
Copy link
Copy Markdown
Contributor

what-the-diff Bot commented Jul 6, 2023

PR Summary

  • Enhanced Checkbox List Functionality
    The code now includes a call to an update function within the 'checkbox list' component. This feature will improve the way the checkboxes in the list appear, providing a better user experience.

Comment thread packages/forms/resources/views/components/checkbox-list.blade.php
@zepfietje zepfietje added the bug Something isn't working label Jul 6, 2023
@zepfietje zepfietje added this to the v2 milestone Jul 6, 2023
@zepfietje zepfietje requested a review from danharrin July 6, 2023 07:55
@danharrin danharrin merged commit a416a58 into filamentphp:2.x Jul 6, 2023
@danharrin
Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants