Forums › Forums › OroPlatform › OroPlatform – How do I? Questions › Autocomplete Search field
This topic contains 2 replies, has 3 voices, and was last updated by alendo 9 years, 3 months ago.
Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.
- CreatorTopic
- November 18, 2014 at 12:20 am #35901
I’ve created a person entity, and I want to create an oro_entity_create_or_select type that filter by name and also by gender. And maybe a few other parameters.
Is this possible ? - CreatorTopic
- AuthorReplies
- November 18, 2014 at 8:00 am #35902
Hi.
To achieve this next steps has to be performed:– Create Form type with parent set to ‘oro_entity_create_or_select_inline’. In defaults set autocomplete_alias and create_form_route. grid_name may be set to grid name which will be used in search dialog, if it does not set then grid_name from entity configuration will be used.
– Add search.yml and define search rules for your Person entity there
– Add service for autocomplete search handler. Tag it with oro_form.autocomplete.search_handler DI tag, set alias to your autocomplete_alias used in form type, set acl_resource.
123456789orocrm_account.form.autocomplete.account.search_handler:parent: oro_form.autocomplete.search_handlerarguments:- %orocrm_account.account.entity.class%- ["name"]tags:- { name: oro_form.autocomplete.search_handler, alias: accounts, acl_resource: orocrm_account_view }– Execute app/console oro:search:index for creating new indexes
– (optional) For Person entity add form configuration scope and set form_type to your select type and grid_name that will be used by oro_entity_create_or_select_inline element as grid_name
12345678910@Config(defaultValues={"form"={"form_type"="orocrm_account_select","grid_name"="accounts-select-grid",},})December 22, 2014 at 9:18 am #35903Hi Dmitry
I followed the steps you suggested, but I have two problems: the autocomplete does not work for me, and even if the datagrid works, when I select a row in the datagrid nothing happens in the input field.
I added also form_type and grid_name to my entity config.
Do you have any suggestion?
thanks
Alesearch.yml
12345678910111213141516EducaCloud\Bundle\BaseTablesBundle\Entity\Professions:alias: educacloud_professionslabel: educa_cloud.base_tables.professions.pluraltitle_fields: [description]route:name: educacloud_professions_viewparameters:id: idsearch_template: EducaCloudBaseTablesBundle:Professions:searchResult.html.twigfields:-name: descriptiontarget_type: texttarget_fields: [description]service.yml
1234567891011121314educa_cloud.form.type.profession_select:class: %educa_cloud.form.type.profession_select.class%tags:- { name: form.type, alias: educa_profession_select }educa_cloud.form.autocomplete.professions.search_handler:parent: oro_form.autocomplete.search_handlerarguments:- %educa_cloud_professions.entity.class%- ["name"]tags:- { name: oro_form.autocomplete.search_handler, alias: professions, acl_resource: educacloud_professions_view } - AuthorReplies
The forum ‘OroPlatform – How do I? Questions’ is closed to new topics and replies.