Skip to content

[Autocomplete] Autocomplete with specific controller - next_page entry isn't parsed after second load #2579

Open
@arlin2050

Description

@arlin2050

Hi,

First of all, thank you for this great project.
I'm facing a problem with ux autocomplete. I use autocomplete_url parameter to fetch results from a specific controller.
As I have many result, I use pagination.
First load and second load works great but after second load, next elements aren't loaded and I have 'No more results'.

Here are the results of my API from first load of url /api/professionnel?query=xxx :
{ "results": [ { "value": 2, "text": "XXX AAAAA" }, { "value": 5, "text": "XXX XXX" }, { "value": 7, "text": "XXX XXX" }, { "value": 8, "text": "XXX XXX" }, { "value": 11, "text": "XXX XXX" }, { "value": 14, "text": "XXX XXX" }, { "value": 18, "text": "XXX XXX" }, { "value": 19, "text": "XXX XXX" }, { "value": 20, "text": "XXX XXX" }, { "value": 26, "text": "XXX XXX" }, { "value": 30, "text": "XXX XXX" }, { "value": 31, "text": "XXX XXX" }, { "value": 37, "text": "XXX XXX" }, { "value": 41, "text": "XXX XXX" }, { "value": 43, "text": "XXX XXX" }, { "value": 44, "text": "XXX XXX" }, { "value": 45, "text": "XXX XXX" }, { "value": 46, "text": "XXX XXX" }, { "value": 50, "text": "XXX XXX" }, { "value": 56, "text": "XXX XXX" }, { "value": 57, "text": "XXX XXX" }, { "value": 58, "text": "XXX XXX" }, { "value": 61, "text": "XXX XXX" }, { "value": 63, "text": "XXX XXX" }, { "value": 74, "text": "XXX XXX" }, { "value": 75, "text": "XXX XXX" }, { "value": 80, "text": "XXX XXX" }, { "value": 87, "text": "XXX XXX" }, { "value": 95, "text": "XXX XXX" }, { "value": 96, "text": "XXX XXX" } ], "next_page": "/api/professionnel?query=xxx&page=2" }
and from second load :
{ "results": [ { "value": 98, "text": "XXX XXX" }, { "value": 100, "text": "XXX XXX" }, { "value": 101, "text": "XXX XXX" }, { "value": 102, "text": "XXX XXX" }, { "value": 104, "text": "XXX XXX" }, { "value": 105, "text": "XXX XXX" }, { "value": 107, "text": "XXX XXX" }, { "value": 108, "text": "XXX XXX" }, { "value": 109, "text": "XXX XXX" }, { "value": 111, "text": "XXX XXX" }, { "value": 116, "text": "XXX XXX" }, { "value": 117, "text": "XXX XXX" }, { "value": 121, "text": "XXX XXX" }, { "value": 132, "text": "XXX XXX" }, { "value": 133, "text": "XXX XXX" }, { "value": 134, "text": "XXX XXX" }, { "value": 139, "text": "XXX XXX" }, { "value": 144, "text": "XXX XXX" }, { "value": 147, "text": "XXX XXX" }, { "value": 148, "text": "XXX XXX" }, { "value": 150, "text": "XXX XXX" }, { "value": 155, "text": "XXX XXX" }, { "value": 156, "text": "XXX XXX" }, { "value": 157, "text": "XXX XXX" }, { "value": 158, "text": "XXX XXX" }, { "value": 165, "text": "XXX XXX" }, { "value": 166, "text": "XXX XXX" }, { "value": 172, "text": "XXX XXX" }, { "value": 173, "text": "XXX XXX" }, { "value": 178, "text": "XXX XXX" } ], "next_page": "/api/professionnel?query=xxx&page=3" }
After first load, 'next_page' entry is used to load more results but after second load I don't have any results.
I've been searching in controller.ts to find why 'next_page' entry isn't used after second load but I didn't find.

I'm not using anything special, no javascript, my field is just a ChoiceType with autocomplete and autocomplete_url options configured.
Can it be a bug or a problem in configuration ?

Thank you for your help

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions