¿How to make a request to my RESTful API with DataManager and display it in DropDownListComponent?

I am currently working with the Scheduler, and inside my editorTemplate() I have a custom HTML, I want that when I make a GET request to my API with route http://localhost:3001/users I get a response like this:

{
    "message": null,
    "data": [
        {
            "idUsuario": "dfeb36ae-7553-4df5-bcaa-ed044bb06d2f",
            "numero_documento": ******,
            "nombres": "*******",
            "apellidos": "*******",
            "direccion": "*******",
            "foto": "*******",
            "correo": "****",
            "contacto": [""],
            "fecha_nacimiento": "*******",
            "estaActivo": ****,
            "country": null,
            "department": null,
            "city": null,
            "gender": null,
            "role": {
                "idRole": "ccc54346-d21e-4898-9718-492987a514b2",
                "nombre": "default"
            },
            "eps": null
        }, ... {}, {}, {}
    ],
    "statusCode": 200
}

I would like that when obtaining the information from my backend I only obtain the properties of "numero_documento" and "nombres" and show me inside the DropDownListComponent


The problem I have now is that when I query my Frontend with DataManager the response is empty, if I'm doing it incorrectly, could you tell me what would be the correct way to do it?...


Captura de Pantalla 2023-07-10 a la(s) 4.35.02 p. m..png


3 Replies

VS Venkateshwaran Saravanakumar Syncfusion Team July 17, 2023 08:24 AM UTC

Hi Juan,

Sample: https://stackblitz.com/edit/react-dk6pub-1xqg4c?file=index.js,index.css

UG: https://ej2.syncfusion.com/react/documentation/data/adaptors#webmethod-adaptor

Since you are using the WebMethodAdaptor, it expects a JSON response from the server. The response object should contain properties named "result" and "count". The "result" property should contain a collection of entities, and the "count" property should represent the total count of the entities. However, your current response does not meet these requirements, making it impossible to obtain values on the front end. We request you to modify your back-end code to provide a response as described below. Refer to the shared UG for more details.

[Expected Response]

 

{

    result: [{..}, {..}, {..}, ...],

    count: 830

}



Regards,
Venkatesh



JS Juan Sebastian Artunduaga Rojas replied to Venkateshwaran Saravanakumar July 18, 2023 09:40 PM UTC

I am working with NextJS13, I did the steps as you told me, but I get this error...


Captura de Pantalla 2023-07-18 a la(s) 4.35.20 p. m..png

Captura de Pantalla 2023-07-18 a la(s) 4.35.34 p. m..png




SK Satheesh Kumar Balasubramanian Syncfusion Team July 19, 2023 12:35 PM UTC

Hi Juan,

We have checked your reported query and suspect that query is not properly given in your dropdown list (or) mismatching our syncfusion packages which is the cause for the reported issue. If you still face the same problem, can you please share issue replicating sample (or) dropdown list and it's related code snippets?

Regards,
Satheesh Kumar B

Loader.
Up arrow icon