NO DATA IS DISPLAYED FROM API

I attach a file with code that shows my problem.


Thanks in advance.

Attachment: MYAPI_e1c63c6a.zip

1 Reply 1 reply marked as answer

RN Rahul Narayanasamy Syncfusion Team April 5, 2021 01:00 PM UTC

Hi Marco, 

Greetings from Syncfusion. 

Query: NO DATA IS DISPLAYED FROM API 

We have validated your query and you are facing complexities while binding the Grid data from WebApiAdaptor. While using WebApiAdaptor to bind the data to Grid, you should return the data as Items and Count pair. So, we suggest you to ensure to return the data from WebApi service/controller as Items and Count pair to get data bind in Grid as explained in below documentation. 

Reference

 

        [HttpGet] 
        public async Task<object> Get(int? code) 
        { 
            . . . 
            if (queryString.Keys.Contains("$inlinecount")) 
            { 
                StringValues Skip; 
                StringValues Take; 
                int skip = (queryString.TryGetValue("$skip", out Skip)) ? Convert.ToInt32(Skip[0]) : 0; 
                int top = (queryString.TryGetValue("$top", out Take)) ? Convert.ToInt32(Take[0]) : data.Count(); 
                var count = data.Count(); 
                 return new { Items = data.Skip(skip).Take(top), Count = count };                
            } 
            else 
            { 
                return data; 
            } 
        } 


Please let us know if you have any concerns. 

Regards, 
Rahul 


Marked as answer
Loader.
Up arrow icon