Rendering issue

I integrated a dhtmlx gantt in one of my project.It is not working while rendering that values in browser.

Error captured on browser:

Request to anyone to help.

Hi,
I’ve closed your topic Dhtmlxgantt Rendering issue as a duplicate of this one. Please don’t double post the same question. If you want to bump the topic to the top, you can just post any update there rather than creating a new one

Hi @inel_ananth!

If I understand you correctly this is the JSON data you got from the server. It seems to be ok with it.

If I understand you correctly, you’re trying to load Gantt data from the backend, and this is JSON data you got from the server. And the issue is that Gantt chart stays empty and doesn’t display any tasks from this JSON?

The JSON on your screenshot looks ok. Can you please send me this JSON in the .txt file. I’ll try to reproduce your issue.
Also please add the screenshot of the error.

Thanks for your reply.

Scenario 1 : If i use render_table on my php side is not working i got the below error.

Scenario 2 : If i comment the render_table code in php gantt is rendring without data

Code which used for testing given for your reference

PHP code:

Template code file :


Kindly give me a better solution to proceed further.

Hi @inel_ananth,

Scenario 1 : If i use render_table on my php side is not working i got the below error.

What you see on the page is not an error, but a correct JSON data produced by dhtmlx connector.
When you call render_table it reads the database, writes the data to the http response and end exits script. dhtmlxGantt can parse such json and display data.

You’re not expected to place dhtmlxConnector call in the same template where html page is defined.

Instead, you need to split it into two pages/templates that can be accessed separately https://www.screencast.com/t/GXJKpIpvHY

  • one handler/route with the connector code that produces JSON data (your Scenario 1)
  • and handler/route that generates a gantt page from a template (your Scenario 2)

Then, the gantt page (Scenario 2) will be able to load data by calling the connector handler (Scenario 1) via gantt.load method:

gantt.load("URL");

Gantt will send an ajax request to the specified url, and if that request return a json response that shown on your first screenshot - gantt will parse it and display tasks

Thanks for your support.

As per your suggestion i created a php file in the same directory which names as "dhtmlx_gantt_std11.demo.php "and tried.But data not loaded in gantt.Pls see the code which is used for testing.
Browser output

dhtmlx_gantt_std11.demo.php:

dhtmlx_gantt_std1.demo.tpl


Great, thanks! So now you are able to open both pages in your browser now - a page with an empty gantt and a page that returns json output, is it correct?

If so, please refer to this guide
https://docs.dhtmlx.com/gantt/desktop__troubleshooting.html
Please open the page with a gantt, open browser dev tools and check for console errors, network requests and server responses, as shown in the article.

You want to check if your gantt page calls the correct url, whether that url returns what you expect and how that data is parsed by gantt. Please follow the steps of the tutorial and tell me what you find.

Also, can you please paste JSON your backend returns in text form here? You’ve previously attached only a screenshot of it:

if you post it in text form I’ll be able to check whether the json itself is ok and can be parsed by gantt.

Thank you I really appreciate your help.
Now it’s working fine while the file moved into index page.Data loading and updating is fine.
But not able to add the data into database.Also not able to zoom the data’s in day,week,month and year wise.
Is there any configuration to be done?

Hi @inel_ananth!

But not able to add the data into database.

Please make sure to set the auto increment to id columns of tasks and links tables, this usually the case for such issues.

Also, I can see you have error logging enabled ($gantt->enable_log in some of your screenshots above). If so, are there any error messages in the log file?

Also not able to zoom the data’s in day,week,month and year wise.

Regarding the time scale, you can check this article:
https://docs.dhtmlx.com/gantt/desktop__time_scale.html

Please check this sample with day, week, month, quarter and year scales:
https://docs.dhtmlx.com/gantt/samples/03_scales/05_dynamic_scales.html