Gantt not showing anything


#1

Dear Friends.
I did the example with laravel.
I check many times everything.
No errors, but gantt not showing data.

Anyone can help?.

This is my ganttcontroller:

<?php

namespace App\Http\Controllers;

use App\Task;
use App\Link;


//use Illuminate\Http\Request;

class GanttController extends Controller
{
  public function get(){
      $tasks = new Task();
      $links = new Link();

      return response()->json([
			"data" => $tasks->all(),
			"links" => $links->all()
		]);

}

this is my view:

<!DOCTYPE html>
<head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">

    <script src="https://cdn.dhtmlx.com/gantt/edge/dhtmlxgantt.js"></script>
    <link href="https://cdn.dhtmlx.com/gantt/edge/dhtmlxgantt.css" rel="stylesheet">

    <style type="text/css">
        html, body{
            height:100%;
            padding:0px;
            margin:0px;
            overflow: hidden;
        }

    </style>
</head>
<body>
<div id="gantt_here" style='width:100%; height:100%;'></div>
<script type="text/javascript">

    gantt.config.xml_date = "%Y-%m-%d %H:%i:%s";

    gantt.init("gantt_here");

    gantt.load("/api/data")
</script>
</body>

and my api:

Route::get('/data', 'GanttController@get');

#2

Hello,
Does your api.php route file have use Illuminate\Http\Request; string?
Have you tried the official demo?


Do you see that Gantt works, but doesn’t save the data or you don’t see Gantt at all? If you don’t get the data from the database, it might be related to routes or something else. But first, you need to check how it works with our demo as it has all necessary configurations.