Grid not displaying any data

Hi, I'm experimenting with using the Grid control in a Django/PostgreSQL backend environment. 

I'm currently implementing the Grid control like this:

Image_1733_1691528650269


if I set it to offline: true and do not ​include the query: new ej.data.Query().where(predicate), the data displays correctly in the grid. However, if I implement as shown in the screenshot. no data displays and no error is reported from the back end, or from the developer console of the browser. If I log the output of the query as such:

Image_1230_1691528825075

I can see all the records it has retrieved. 

I am unsure why the Grid displays no data currently using the above methods.



3 Replies 1 reply marked as answer

PS Pavithra Subramaniyam Syncfusion Team August 9, 2023 10:04 AM UTC

Hi Mark Griffiths,


The Grid dataSource will accept DataManager or Object of array values. In your second code example, we could see that you are executing the query in DataManager which will return only promise and assign this to the grid dataSource which is the reason of your issue. So, we suggest setting the grid dataSource inside the “then” function of the executeQuery method. Please refer to the below code example for more information.


var grid = new ej.grids.Grid({

        .  .  .

    });

 

manager = new ej.data.DataManager({

  url: hostUrl,

  adaptor: new ej.data.UrlAdaptor()

}).executeQuery(new ej.data.Query()).then((e) => {

  grid.dataSource = e.result;

})

grid.appendTo('#Grid');

 


Please get back to us if you need further assistance on this.


Regards,

Pavithra S


Marked as answer

MG Mark Griffiths August 9, 2023 01:14 PM UTC

That did it, thank you very much!



SG Suganya Gopinath Syncfusion Team August 10, 2023 02:56 PM UTC

We are glad that the provided solution helped to solve the issue.


Loader.
Up arrow icon