Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature][3.5][Ready] Select2 grouped #1688

Merged
merged 2 commits into from Nov 9, 2018
Merged

Conversation

tabacitu
Copy link
Member

@tabacitu tabacitu commented Nov 9, 2018

This field allows you to specify a second entity, by which your select2 entries will be grouped.

Definition:

        $this->crud->addField([
            'label' => 'Articles grouped by categories',
            'type' => 'select2_grouped', //https://github.com/Laravel-Backpack/CRUD/issues/502
            'name' => 'article_id',
            'entity' => 'article',
            'attribute' => 'title',
            'group_by' => 'category', // the relationship to entity you want to use for grouping
            'group_by_attribute' => 'name', // the attribute on related model, that you want shown
            'group_by_relationship_back' => 'articles', // relationship from related model back to this model
        ]);

Screenshot:
screenshot 2018-11-09 at 16 49 26

@tabacitu tabacitu merged commit 2fb64b5 into release-3-5 Nov 9, 2018
@tabacitu tabacitu deleted the select2-grouped branch November 9, 2018 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant