We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Unable to display data in a grid

Thread ID:

Created:

Updated:

Platform:

Replies:

132759 Sep 19,2017 11:59 AM Jun 13,2018 02:24 AM PHP 4
loading
Tags: Grid
Mohan
Asked On September 19, 2017 11:59 AM

Hi,

I am trying the following:

<html>
<head> 
<link rel="stylesheet" rel='nofollow' href="themes/bootstrap-theme/ej.web.all.min.css" /> 
<script src="scripts/external/jsrender.min.js"></script>
<script src="scripts/external/jquery-3.1.1.min.js"></script> 
<script src="scripts/web/ej.web.all.min.js"> </script> 
</head> 
<body>
<?php require_once 'Src/AutoLoad.php'; ?>

<div class="cols-sample-area">
    <?php
   
    $Json = json_decode(file_get_contents("data.json"), true);
print_r($Json);
    $col1 = new EJ\Grid\Column();
    $col1->field("OrderID")->headerText("OrderID")->textAlign("right")->width(100);
    $col2 = new EJ\Grid\Column();
    $col2->field("CustomerID")->headerText("CustomerID")->width(70);
    $col3 = new EJ\Grid\Column();
    $col3->field("EmployeeID")->headerText("EmployeeID")->textAlign("right")->width(70);
    $col4 = new EJ\Grid\Column();
    $col4->field("ShipCountry")->headerText("ShipCountry")->width(70);
    $col5 = new EJ\Grid\Column();
    $col5->field("Freight")->headerText("Freight")->textAlign("right")->format("{0:C}")->width(70);
    $gridColumns = array($col1,$col2,$col3,$col4,$col5);
    $grid =  new EJ\Grid("Grid");
    $column=new EJ\Grid\Column();
    echo $grid -> dataSource($Json)->allowPaging(true)->columns($gridColumns)->render();
    ?>

</div>
<style>
    .cols-sample-area {
        margin: 0 auto;
        float: none;
    }
</style>
</body>
</html>

The data.json is from syncfusion samples.
The program does show that it is reading the data.json correctly bu displaying its contents in text form.
However, when it comes to displaying in the grid, it says "33 lines", but it is always empty and not displaying any data in the grid.

I have tried this with and without the line 
<script src="scripts/external/jsrender.min.js"></script>
in the header.

What is the right way to do this?

TIA
Mohan.

Mohan
Replied On September 19, 2017 12:46 PM

Replying my own question - may be this would help someone else..

The order in which js files are listed in the header makes a difference (On hindsight this is obvious!)

T changed the header like so:

<head> 

<link rel="stylesheet" rel='nofollow' href="themes/bootstrap-theme/ej.web.all.min.css" /> 

<script src="scripts/external/jquery-3.1.1.min.js"></script> 

<script src="scripts/external/jsrender.min.js"></script>

<script src="scripts/web/ej.web.all.min.js"> </script> 

</head> 

and it worked.

Mohan.


Mani Sankar Durai [Syncfusion]
Replied On September 20, 2017 07:23 AM

Hi Mohan, 

We are happy to hear that your problem has been solved.  

Please let us know if you need further assistance. 

Regards, 
Manisankar Durai. 


raunakgarg
Replied On June 12, 2018 06:06 AM

Thanks Mohan for giving solution of the above problem. This problem could occur with any fresher or even experienced in PHP. 

Kuralarasan Muthusamy [Syncfusion]
Replied On June 13, 2018 02:24 AM

Hi Customer, 

Thank you all. 

Regards, 
Kuralarasan M. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;