Closed milacay closed 4 years ago
Uhm.. i've not been using the export XML... can you copy and paste the full error stack here?
But if you would like to keep the original ID... u can pass that as a custom field.. like originalId...
Basically, I use your docs\demo.html for playground.
I added two inputs below:
<input type="button" id="btnExport" onClick="exportAll()" value="Export All"/>
<input id="exportPID" onchange="exportPID(this.value);" value="" type="number" placeholder="Enter the pID">
Here are the basic functions to test the XML: `
<script>
function exportAll()
{
var v1 = g.getXMLProject();
console.log(v1);
}
function exportPID(pID)
{
console.log("pID: " + pID);
var v1 = g.getXMLTask(pID);
console.log(v1);
}
</script>
Problem# 1: If I clicked the "btnExport" button to execute (getXMLProject()), I get the "TypeError: pDate is null".
Problem# 2: I entered "1" in the "exportPID" input textbox, I get <empty string>
return. According to the document, the getXMLTask(pID, pIdx) takes the pID so the "Define Chart API" has the pID# 1 in the data.json file. I tried your "Print data in Console" button in the demo.html and it seems like the "Define Chart API" task has pID# 177622 somehow. I am not sure how the difference betwee pID in the data.json vs pID output from the "Print data in console"
I didn't see the "originalId" in the Task Parameter, can you please provide me the example code how to get the information for "Define Chart API" where I know the pID is 1 in the data.json?
Basically, I am looking for a function to export the task data (All or by individual pID). I can be XML, JSON, or comma delimited.
BTW, This is an awesome Gantt chart you have.
Thank you,
oww i see.. so use the JSON export.. this is more reliable..
about the error.. if you can copy and paste the complete error.. like with the line where the error occurs and the stacktrace.. will help to find the problem
Here is the error:
TypeError: pDate is nulljsgantt.js:3776:21
formatDateStr http://servername/Test2/Charts/jsgantt2/dist/jsgantt.js:3776
getXMLTask http://servername/Test2/Charts/jsgantt2/dist/jsgantt.js:5098
getXMLProject http://servername/Test2/Charts/jsgantt2/dist/jsgantt.js:5070
exportAll http://servername/Test2/Charts/jsgantt2/docs/test1.html:257
onclick http://servername/Test2/Charts/jsgantt2/docs/test1.html:1
It looks like it failed at line# 3776 var vYear2Str = pDate.getFullYear().toString().substring(2, 4);
about "Print Data in Console" (see sample output below)... Do you know why the pID is 177622
instead of 1
?
`category: "Planning"
pClass: "ggroupblack"
pComp: 0
pCost: NaN
pDataObjec: Object { category: "Planning", sector: "CMO" }
pEnd: Date Mon Jul 29 2019 00:00:00 GMT-0700 (Pacific Daylight Time)
pGroup: 1
pGroupMinEnd: null
pGroupMinStart: null
pID: 177622
pLink: ""
pMile: 0
pName: "Define Chart API"
pPlanEnd: null
pPlanStart: null
pRes: "Mario"
pStart: Date Thu Jun 20 2019 00:00:00 GMT-0700 (Pacific Daylight Time)
sector: "CMO"`
I thanks for your info!
I added this fix in the latest version!
I tried to export the data to XML, but keep getting. For example, the first "Define Chart API" is the pID# 1 in the data.json file. When executed this . Later, I found out in the console.log that the "Define Chart API" pID is actually 177622 (not same as the data.json) file. Is this a bug? How can I export XML string using the pID from the data.json?
g.getXMLTask(1);
, I getAlso, when I executed this
g.getXMLProject();
, I keep getting error "TypeError: pDate is null". I am not sure how to make it works.Thank you,