NO data display in the grid

Hello. I am a new one on using your product, just try to evaluate. I just write my first application, but there is no data dislpay
This is index.js file. Using the url wich return a JSON file : it is OK , I use it every day. What is wrong with my code ?. Thanks a lot
var data = new ej.data.DataManager({
    url: 'http://sdsragusa.andrasoft.online/ecom/tab_cli_02.php',
    adaptor: new ej.data.ODataV4Adaptor()
});
ej.grids.Grid.Inject(ej.grids.Sort);
var grid = new ej.grids.Grid({
    dataSource: data,
    allowSorting: true,
    allowFiltering: true,
    columns: [
                { field: 'agente', width: 140, headerText: 'Ag', type: 'string' },
                { field: 'cod_cliente', width: 140, headerText: 'Cod', type: 'string' },
                { field: 'ragione_sociale', headerText: 'Ragione sociale', textAlign: 'Right', width: 120},
                { field: 'indirizzo', headerText: 'Indirizzo', width: 140}
    ]
});

grid.appendTo('#Grid');

3 Replies 1 reply marked as answer

SK Sujith Kumar Rajkumar Syncfusion Team May 11, 2021 01:18 PM UTC

Hi Teodor, 
 
Greetings from Syncfusion support. 
 
Based on the provided information and URL link we could see that you are trying to use the ODataV4 adaptor for binding data to the Grid. The reported problem is occurring because the data is not returned to the Grid in the proper format. For the ODataV4 adaptor, the result needs to be returned as an object of value(result in JSON format) and @odata.count(total record count) property as shown in the below image, 
 
 
 
We have prepared a sample based on this for your reference. You can find it below, 
 
 
 
So please return the result in the mentioned format to resolve your reported problem. 
 
Please get back to us if you require any further assistance. 
 
Regards, 
Sujith R 



SR Sabitha Rajamani Syncfusion Team May 12, 2021 05:08 AM UTC

From: Teodor Cezar Tabacaru
Sent: Tuesday, May 11, 2021 11:10 AM
To: Syncfusion Support
Subject: Re: Syncfusion support community forum 165304, NO data display in the grid, has been updated. 
  

Good afternoon 
Thanks for your response.  
Obviously I understand that my "response" is not what Your software is expected, but I would like to know if a "standard" JSON FILE can be used. 
You can understand that actual service , wich return a "standard" JSON FILE can not be modified. By the way, the same process is used by AG-GRID,DATAGRID,TABULATOR without any modification 
So my question is about how can I use my "standard" JSON FILE with SYNCFUSION ? Maybe there is another "object"  wich can be used ? 
Thanks ! 



VS Vignesh Sivagnanam Syncfusion Team May 13, 2021 07:00 PM UTC

Hi Teodor, 
 
Thanks for the update.  
 
By default, in EJ2 Grid when we used Syncfusion Grid inbuilt adaptors you need to return the data on particular format for each adaptors. To achieve your requirement, we suggest you to use the Ajax binding feature in the EJ2 Grid.  
  
Please refer the below Code example, sample and Documentation for your reference, 
  
ajax.send(); 
ajax.onSuccess = function (data: string) { 
    grid.dataSource = JSON.parse(data); 
}; 
  
  
Regards 
Vignesh Sivagnanam 


Marked as answer
Loader.
Up arrow icon