Our state of the art Gantt chart


Post by rahulranjan »

Hi i am trying to connect to server to load and sync the data But its giving error - Angular 6 Project
const project = new ProjectModel({
      autoLoad: true,
      transport: {
        load: {
          method: 'GET',
          disableCaching: false,
          url: 'https://localhost:8028/ganttServer/load.php',
          paramName: 'q'
        },
        sync: {
          url: 'https://localhost:8028/ganttServer/sync.php'
        }
      }
    });
Error: core.js:1673 ERROR Error: Uncaught (in promise): TypeError: Failed to fetch
TypeError: Failed to fetch
    at resolvePromise (zone.js:831)
    at resolvePromise (zone.js:788)
    at zone.js:892
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
    at Object.onInvokeTask (core.js:3811)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
    at drainMicroTaskQueue (zone.js:601)

But if same server url i put in browser it retrieves the data
Url =>https://localhost:8028/ganttServer/load.php?q=%7B%22type%22%3A%22load%22%2C%22requestId%22%3A%2215583370074430%22%2C%22stores%22%3A%5B%22calendars%22%2C%22tasks%22%2C%22dependencies%22%2C%22resources%22%2C%22assignments%22%5D%7D
I am able to retrieve the data
Can you let me know where i am going wrong.

Post by mats »

First try to debug yourself, set breakpoints in your server code and see what is going on.

Post by rahulranjan »

Hi mats
Server i debugged its all fine data is being returned from server.

Post by mats »

Ok then set breakpoint where it fails to parse it. Most likely something wrong with your data.

Post by rahulranjan »

Hi mats
When i hit backend directly using url it gives me data
Image
Link to image data from server - https://drive.google.com/file/d/1FMfEx3 ... sp=sharing
I am getting one more error
TypeError: _0x2b6580[_0x1d79(...)] is not a function
    at ProjectModel.cancelRequest (gantt.module.js:150)
    at gantt.module.js:151
    at new ZoneAwarePromise (zone.js:910)
    at ProjectModel.load (gantt.module.js:151)
    at AppComponent.<anonymous> (app.component.ts:101)
    at step (main.js:623)
    at Object.next (main.js:604)
    at main.js:598
    at new ZoneAwarePromise (zone.js:910)
    at push../src/app/app.component.ts.__awaiter (main.js:594)

Post by mats »

Again, please always post code + error messages using CODE tags. Please debug this method and look at the data you return to make sure it's valid.

Post by rahulranjan »

Its valid , you can see the image . Open the link of image you will get it

Post by mats »

Image shows nothing of value. We cannot support you with this I'm afraid. Try to upload your data into the advanced sample instead and debug it there, or produce a clear minimal test case for us that we can inspect.

Post by rahulranjan »

Okay
SO let start
1. Using transport i want to load and sync data from backend.
UI Code for it - project build in angular 6
   const project = new ProjectModel({
      autoLoad: true,
      transport: {
        load: {
          method: 'GET',
          disableCaching: false,
          url: 'https://localhost:8028/ganttServer/load.php',
          paramName: 'q'
        },
        sync: {
          url: 'https://localhost:8028/ganttServer/sync.php'
        }
      }
And at last this.
 project.load().then(() => {
      console.log('Project Loaded')
    }).catch(err => {
      console.log(err);
    });
The Backend server i am using is same as provided in trial gantt (Gantt with php and Mysql);
Even Sql is also same. Only Php code i am using from here itself wants the same data should load sync. Mysql Database and tables are setup with script provided in the trial.

unable to fetch the data from server error from client -
TypeError: _0x2b6580[_0x1d79(...)] is not a function
    at ProjectModel.cancelRequest (gantt.module.js:150)
    at gantt.module.js:151
    at new ZoneAwarePromise (zone.js:910)
    at ProjectModel.load (gantt.module.js:151)
    at AppComponent.<anonymous> (app.component.ts:101)
    at step (main.js:623)
    at Object.next (main.js:604)
    at main.js:598
    at new ZoneAwarePromise (zone.js:910)
    at push../src/app/app.component.ts.__awaiter (main.js:594)
url that hits the server - https://localhost:8028/ganttServer/load. ... s%22%5D%7D

If same url i copy and paste in browser it returns data -
Image link of data return - https://drive.google.com/file/d/1FMfEx3 ... sp=sharing

But in ui only i am getting problem to load

I think now its enough to produce for you. If any thing more is needed please let me know.

Post by pmiklashevich »

Could you please modify our example until it starts failing, zip it up and upload here? Then we can debug the problem.

Pavlo Miklashevych
Sr. Frontend Developer


Post Reply