ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 13 replies, has 4 voices, and was last updated by prganvani prganvani 6 months ago.

  • Creator
    Topic
  • #7702
    alendo
    alendo
    Participant

    Hi
    I followed the steps to create a oro_entity_create_or_select_inline field, 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
    Ale
    search.yml

    service.yml

    class ProfessionSelectType extends AbstractType
    {
    /**
    * {@inheritdoc}
    */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
    $resolver->setDefaults(
    [
    ‘autocomplete_alias’ => ‘professions’,
    ‘configs’ => [
    ‘placeholder’ => ‘ec.event_professions.form.choose_profession’
    ],
    ]
    );
    }

    /**
    * {@inheritdoc}
    */
    public function getParent()
    {
    return ‘oro_entity_create_or_select_inline’;
    }

    /**
    * {@inheritdoc}
    */
    public function getName()
    {
    return ‘educa_profession_select’;
    }
    }

Viewing 13 replies - 1 through 13 (of 13 total)
  • Author
    Replies
  • #7706

    Alexandr Smaga
    Participant

    Hey @alendo!

    Are there any JS/PHP error when trying to search(just open autocomplete box) ?
    Also did you run reindex on your existing entities when configure search for them ?

    #7711
    alendo
    alendo
    Participant

    Hi @Alexndr
    No, there is not any js/php error.
    I reindexed and in log file I see reindex log for professions as:

    so I think that it is correctly indexed.
    My concern is that autocomplete doesn’t work but also select from grid: are these two things related?
    Thank you
    Alessandra

    #7712
    alendo
    alendo
    Participant

    I tried also to search my entity by using the search form on the top and it works with autocomplete!

    #7715
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    Hello, alendo.

    As for search autocomplete:

    1) A bit confusing thing that you have only description in search index, but use name to render results – maybe, you should add name to search index too?
    2) You can check real response coming from backend using firebug (on similar tool), just check JSON response.
    3) You can add a breakpoint into SearchHandler::search and check whether is really can find requested entities.

    As for selecttion from grid:

    1) Look’s like you didn’t specify grid name you want to use. You can do that either in entity configuration, or manually as a form type option.
    2) Grid you are using to select entities must have identifier column (“id” by default) that is used to set data to selector.

    #7726
    alendo
    alendo
    Participant

    Thanks for your answer.
    For search autocomplete:
    1 – I added name to search index, I suppose

    2 – The returned json says this:
    {“results”:[],”hasMore”:false,”errors”:[“Access denied.”]}
    I suppose there is an ACL problem but I don’t understand where, because I’m working with admin user.

    For selection from grid (this is a big concern!) it seems all ok:
    1 – I added form_type and grid_name to my entity config as I said in the first post.

    2 – The grid works, but when I select a row from the grid the input field doesn’t change, remains empty.

    #7733
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    > 1 – I added name to search index, I suppose
    If your entity has property name then you have to set “name: name” in search yml, if no – replace name with description in search handler definition (here – [“name”]).

    > ”errors”:[“Access denied.”]
    This is where you have to dig into the problem. Look’s like you don’s have an acces to ACL resource “educacloud_professions_view”. You can check it using method SecurityFacade::isGranted.

    > when I select a row from the grid the input field doesn’t change, remains empty.
    I think it’s a consequence of ACL issue. Fix it and try this case again.

    #7751
    alendo
    alendo
    Participant

    Hello Yevhen
    it returns access denied on the autocomplete query. If I try the query using the browser url input it doesn’t work:

    returns a stack trace error:

    If I try another autocomplete query it works, for example:

    and returns:

    #7752
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    Please, check whether you have as access to ACL resource “educacloud_professions_view”. You can add breakpoint here and check it.

    #7753
    alendo
    alendo
    Participant

    Hello Yevhen
    I stepped forward and now almost works even if I cannot see the value of the field (autocomplete give results but they are blank options, and when I select one option the field seems full but there is not a value inside, when I save it saves the right value). I changed the name of the ACL in the controller: I put the same name in the route name and in the ACL id. I don’t understand exactly the reason, because in my mind the first is the route name and the ACL id is another thing.

    #7754
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    > autocomplete give results but they are blank options, and when I select one option the field
    Please, check whether your entity has properties that you defined in search handles definition (in your code there is only one “name”).

    > the first is the route name and the ACL id is another thing.
    That’s correct, these are two diferenct things – you don’t have to have the same name for them.

    #7755
    alendo
    alendo
    Participant

    It works!
    Thanks

    #30677
    prganvani
    prganvani
    Participant

    I use same come but got an error

    Fatal error: Uncaught exception ‘Symfony\Component\DependencyInjection\Exception\RuntimeException’ with message ‘The parent definition “plugins_helper.autocomplete.name.search_handler” defined for definition “plugins_helper.form.autocomplete.industry.search_handler” does not exist.’

    #30681
    prganvani
    prganvani
    Participant

    error is: The option “grid_name” must be set.

    I already set grid_name and from_type in entity.

    “form”={
    * “form_type”=”helper_industry_select”,
    * “grid_name”=”helper-industry-grid”,
    * },

Viewing 13 replies - 1 through 13 (of 13 total)

You must be logged in to reply to this topic.