Gantt, Ajax Error


#1

Hello,
I am using dhtmlxScheduler v.5.1.0 Professional
and i have an error when updating data from gantt
gantt_console

this is my js code :
gantt.init(“task_gantt”);
gantt.clearAll();
gantt.load(“gantt/gantt_task.php”);
var dp = new dataProcessor(“gantt/gantt_task.php”);
dp.init(gantt);

this is my php code:
include(‘connector/gantt_connector.php’);
include(‘connector/options_connector.php’);
require(“connector/db_postgre.php”);

$dbtype=“Postgre”;
$postrgre_connection = “host=hostname port=5433 dbname=bdname user=dbuser password=dbpassword”;
$res=pg_connect($postrgre_connection);

$gantt = new JSONGanttConnector($res, $dbtype);
$gantt->render_sql(“SELECT * FROM project”,“id_project”,“start_date,end_date,project_name,duration”);

Can you please help ?
Thanks.


#2

Hello Christoph,
It is hard to suggest what might be wrong as I don’t see your code and don’t have enough information on how to reproduce the issue.
Please, send me your full PHP project or a new PHP project where I can reproduce the issue.


#3

This is the complete code

index.php

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title><?php echo $lang['PAGE_TITLE']; ?></title>

<link href="favicon.ico" rel="shortcut icon">

<!-- SUMMERNOTE -->
<link href="css/plugins/summernote/summernote.css" rel="stylesheet">
<link href="css/plugins/summernote/summernote-bs3.css" rel="stylesheet"> 

<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="font-awesome/css/font-awesome.css" rel="stylesheet">
<link href="css/plugins/iCheck/custom.css" rel="stylesheet">
<link href="css/plugins/jasny/jasny-bootstrap.min.css" rel="stylesheet">
<link href="css/proposal.css" rel="stylesheet">
<link href="css/animate.css" rel="stylesheet">

<!-- Clock picker -->
<link href="css/plugins/clockpicker/clockpicker.css" rel="stylesheet">

<!-- Chosen -->
<link href="css/plugins/chosen/chosen.css" rel="stylesheet">

<!-- Text spinners style -->
<link href="css/plugins/textSpinners/spinners.css" rel="stylesheet">

<!-- Leaflet -->
<link rel="stylesheet" href="js/plugins/leaflet/leaflet.css">
<link rel="stylesheet" href="js/plugins/Leaflet.draw-develop/src/leaflet.draw.css"/>
<link rel="stylesheet" href="js/plugins/leaflet-locatecontrol-gh-pages/src/L.Control.Locate.css">

<link rel="stylesheet" href="js/plugins/Leaflet.EasyButton-master/src/easy-button.css" />
<link rel="stylesheet" href="js/plugins/Leaflet.markercluster/MarkerCluster.css" />
<link rel="stylesheet" href="js/plugins/Leaflet.markercluster/MarkerCluster.Default.css" />

<!-- FooTable -->
<link href="css/plugins/footable/footable.core.css" rel="stylesheet">

<!-- c3 Charts  
<link href="css/plugins/c3/c3.min.css" rel="stylesheet">

<!-- Datatable -->
<link href="css/plugins/dataTables/datatables.min.css" rel="stylesheet">

<!-- Material Design Bootstrap -->
<link href="css/style.css" rel="stylesheet">
<link href="css/plugins/toastr/toastr.min.css" rel="stylesheet">

<link href="css/plugins/datapicker/datepicker3.css" rel="stylesheet">

<!-- Sweet Alert -->
<link href="css/plugins/sweetalert/sweetalert.css" rel="stylesheet">

<!-- Gantt -->
<link rel="stylesheet" href="gantt/dhtmlxgantt.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="css/dhtmlxscheduler_material.css" type="text/css" charset="utf-8">

<!-- Include SmartWizard CSS -->
<link href="css/plugins/SmartWizard/smart_wizard.css" rel="stylesheet" type="text/css" />

<link rel="stylesheet" href="js/plugins/jQuery-iviewer/jquery.iviewer.css" />
<link href="css/crm.css" rel="stylesheet">

<!-- Dual Listbox -->
<link href="css/plugins/dualListbox/bootstrap-duallistbox.min.css" rel="stylesheet">

<style>
	.dhx_scale_bar{
		line-height: 23px;
	}
</style>
<!-- Task Management -->
<div id="db_tasks" class="page hide">
	<div class="hide" style="text-align: center;height: 40px;line-height: 40px;">
		<div class="col-md-3 col-sm-4 col-xs-4 pull-left">
			<div class="input-group">
				<input type="text" class="form-control typeahead_1" placeholder="<?php echo $lang['GTT_SEARCH']; ?>" name="srch-tasks" id="srch-tasks">
				<div class="input-group-btn">
					<button class="btn btn-default" onclick="tasks();" style="padding:9px 12px;">
					<i class="fa fa-search"></i></button>
				</div>
			</div>
		</div>
	</div>
	<div class="row animated fadeInRight">
		<div class="col-lg-12">
			<button class="btn btn-warning pull-right" onclick="toggleMode(this)"><?php echo $lang['GTT_ZOOM_TFIT_BTN']; ?></button>
			<div class="ibox float-e-margins">
				<div class="ibox-content">
					<div id="task_gantt" style='width:100%; height:90%;'></div>
				</div>
			</div>
		</div>
	</div>
</div>
<script src="js/plugins/fullcalendar/moment.min.js"></script>
<script src="js/jquery-2.1.1.js"></script>
<script src="js/bootstrap.min.js"></script>

<script>
/* jquery.form.min.js */
(function(e){"use strict";if(typeof define==="function"&&define.amd){define(["jquery"],e)}else{e(typeof jQuery!="undefined"?jQuery:window.Zepto)}})(function(e){"use strict";function r(t){var n=t.data;if(!t.isDefaultPrevented()){t.preventDefault();e(t.target).ajaxSubmit(n)}}function i(t){var n=t.target;var r=e(n);if(!r.is("[type=submit],[type=image]")){var i=r.closest("[type=submit]");if(i.length===0){return}n=i[0]}var s=this;s.clk=n;if(n.type=="image"){if(t.offsetX!==undefined){s.clk_x=t.offsetX;s.clk_y=t.offsetY}else if(typeof e.fn.offset=="function"){var o=r.offset();s.clk_x=t.pageX-o.left;s.clk_y=t.pageY-o.top}else{s.clk_x=t.pageX-n.offsetLeft;s.clk_y=t.pageY-n.offsetTop}}setTimeout(function(){s.clk=s.clk_x=s.clk_y=null},100)}function s(){if(!e.fn.ajaxSubmit.debug){return}var t="[jquery.form] "+Array.prototype.join.call(arguments,"");if(window.console&&window.console.log){window.console.log(t)}else if(window.opera&&window.opera.postError){window.opera.postError(t)}}var t={};t.fileapi=e("<input type='file'/>").get(0).files!==undefined;t.formdata=window.FormData!==undefined;var n=!!e.fn.prop;e.fn.attr2=function(){if(!n){return this.attr.apply(this,arguments)}var e=this.prop.apply(this,arguments);if(e&&e.jquery||typeof e==="string"){return e}return this.attr.apply(this,arguments)};e.fn.ajaxSubmit=function(r){function k(t){var n=e.param(t,r.traditional).split("&");var i=n.length;var s=[];var o,u;for(o=0;o<i;o++){n[o]=n[o].replace(/\+/g," ");u=n[o].split("=");s.push([decodeURIComponent(u[0]),decodeURIComponent(u[1])])}return s}function L(t){var n=new FormData;for(var s=0;s<t.length;s++){n.append(t[s].name,t[s].value)}if(r.extraData){var o=k(r.extraData);for(s=0;s<o.length;s++){if(o[s]){n.append(o[s][0],o[s][1])}}}r.data=null;var u=e.extend(true,{},e.ajaxSettings,r,{contentType:false,processData:false,cache:false,type:i||"POST"});if(r.uploadProgress){u.xhr=function(){var t=e.ajaxSettings.xhr();if(t.upload){t.upload.addEventListener("progress",function(e){var t=0;var n=e.loaded||e.position;var i=e.total;if(e.lengthComputable){t=Math.ceil(n/i*100)}r.uploadProgress(e,n,i,t)},false)}return t}}u.data=null;var a=u.beforeSend;u.beforeSend=function(e,t){if(r.formData){t.data=r.formData}else{t.data=n}if(a){a.call(this,e,t)}};return e.ajax(u)}function A(t){function T(e){var t=null;try{if(e.contentWindow){t=e.contentWindow.document}}catch(n){s("cannot get iframe.contentWindow document: "+n)}if(t){return t}try{t=e.contentDocument?e.contentDocument:e.document}catch(n){s("cannot get iframe.contentDocument: "+n);t=e.document}return t}function k(){function f(){try{var e=T(v).readyState;s("state = "+e);if(e&&e.toLowerCase()=="uninitialized"){setTimeout(f,50)}}catch(t){s("Server abort: ",t," (",t.name,")");_(x);if(w){clearTimeout(w)}w=undefined}}var t=a.attr2("target"),n=a.attr2("action"),r="multipart/form-data",u=a.attr("enctype")||a.attr("encoding")||r;o.setAttribute("target",p);if(!i||/post/i.test(i)){o.setAttribute("method","POST")}if(n!=l.url){o.setAttribute("action",l.url)}if(!l.skipEncodingOverride&&(!i||/post/i.test(i))){a.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"})}if(l.timeout){w=setTimeout(function(){b=true;_(S)},l.timeout)}var c=[];try{if(l.extraData){for(var h in l.extraData){if(l.extraData.hasOwnProperty(h)){if(e.isPlainObject(l.extraData[h])&&l.extraData[h].hasOwnProperty("name")&&l.extraData[h].hasOwnProperty("value")){c.push(e('<input type="hidden" name="'+l.extraData[h].name+'">').val(l.extraData[h].value).appendTo(o)[0])}else{c.push(e('<input type="hidden" name="'+h+'">').val(l.extraData[h]).appendTo(o)[0])}}}}if(!l.iframeTarget){d.appendTo("body")}if(v.attachEvent){v.attachEvent("onload",_)}else{v.addEventListener("load",_,false)}setTimeout(f,15);try{o.submit()}catch(m){var g=document.createElement("form").submit;g.apply(o)}}finally{o.setAttribute("action",n);o.setAttribute("enctype",u);if(t){o.setAttribute("target",t)}else{a.removeAttr("target")}e(c).remove()}}function _(t){if(m.aborted||M){return}A=T(v);if(!A){s("cannot access response document");t=x}if(t===S&&m){m.abort("timeout");E.reject(m,"timeout");return}else if(t==x&&m){m.abort("server abort");E.reject(m,"error","server abort");return}if(!A||A.location.href==l.iframeSrc){if(!b){return}}if(v.detachEvent){v.detachEvent("onload",_)}else{v.removeEventListener("load",_,false)}var n="success",r;try{if(b){throw"timeout"}var i=l.dataType=="xml"||A.XMLDocument||e.isXMLDoc(A);s("isXml="+i);if(!i&&window.opera&&(A.body===null||!A.body.innerHTML)){if(--O){s("requeing onLoad callback, DOM not available");setTimeout(_,250);return}}var o=A.body?A.body:A.documentElement;m.responseText=o?o.innerHTML:null;m.responseXML=A.XMLDocument?A.XMLDocument:A;if(i){l.dataType="xml"}m.getResponseHeader=function(e){var t={"content-type":l.dataType};return t[e.toLowerCase()]};if(o){m.status=Number(o.getAttribute("status"))||m.status;m.statusText=o.getAttribute("statusText")||m.statusText}var u=(l.dataType||"").toLowerCase();var a=/(json|script|text)/.test(u);if(a||l.textarea){var f=A.getElementsByTagName("textarea")[0];if(f){m.responseText=f.value;m.status=Number(f.getAttribute("status"))||m.status;m.statusText=f.getAttribute("statusText")||m.statusText}else if(a){var c=A.getElementsByTagName("pre")[0];var p=A.getElementsByTagName("body")[0];if(c){m.responseText=c.textContent?c.textContent:c.innerText}else if(p){m.responseText=p.textContent?p.textContent:p.innerText}}}else if(u=="xml"&&!m.responseXML&&m.responseText){m.responseXML=D(m.responseText)}try{L=H(m,u,l)}catch(g){n="parsererror";m.error=r=g||n}}catch(g){s("error caught: ",g);n="error";m.error=r=g||n}if(m.aborted){s("upload aborted");n=null}if(m.status){n=m.status>=200&&m.status<300||m.status===304?"success":"error"}if(n==="success"){if(l.success){l.success.call(l.context,L,"success",m)}E.resolve(m.responseText,"success",m);if(h){e.event.trigger("ajaxSuccess",[m,l])}}else if(n){if(r===undefined){r=m.statusText}if(l.error){l.error.call(l.context,m,n,r)}E.reject(m,"error",r);if(h){e.event.trigger("ajaxError",[m,l,r])}}if(h){e.event.trigger("ajaxComplete",[m,l])}if(h&&!--e.active){e.event.trigger("ajaxStop")}if(l.complete){l.complete.call(l.context,m,n)}M=true;if(l.timeout){clearTimeout(w)}setTimeout(function(){if(!l.iframeTarget){d.remove()}else{d.attr("src",l.iframeSrc)}m.responseXML=null},100)}var o=a[0],u,f,l,h,p,d,v,m,g,y,b,w;var E=e.Deferred();E.abort=function(e){m.abort(e)};if(t){for(f=0;f<c.length;f++){u=e(c[f]);if(n){u.prop("disabled",false)}else{u.removeAttr("disabled")}}}l=e.extend(true,{},e.ajaxSettings,r);l.context=l.context||l;p="jqFormIO"+(new Date).getTime();if(l.iframeTarget){d=e(l.iframeTarget);y=d.attr2("name");if(!y){d.attr2("name",p)}else{p=y}}else{d=e('<iframe name="'+p+'" src="'+l.iframeSrc+'" />');d.css({position:"absolute",top:"-1000px",left:"-1000px"})}v=d[0];m={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(t){var n=t==="timeout"?"timeout":"aborted";s("aborting upload... "+n);this.aborted=1;try{if(v.contentWindow.document.execCommand){v.contentWindow.document.execCommand("Stop")}}catch(r){}d.attr("src",l.iframeSrc);m.error=n;if(l.error){l.error.call(l.context,m,n,t)}if(h){e.event.trigger("ajaxError",[m,l,n])}if(l.complete){l.complete.call(l.context,m,n)}}};h=l.global;if(h&&0===e.active++){e.event.trigger("ajaxStart")}if(h){e.event.trigger("ajaxSend",[m,l])}if(l.beforeSend&&l.beforeSend.call(l.context,m,l)===false){if(l.global){e.active--}E.reject();return E}if(m.aborted){E.reject();return E}g=o.clk;if(g){y=g.name;if(y&&!g.disabled){l.extraData=l.extraData||{};l.extraData[y]=g.value;if(g.type=="image"){l.extraData[y+".x"]=o.clk_x;l.extraData[y+".y"]=o.clk_y}}}var S=1;var x=2;var N=e("meta[name=csrf-token]").attr("content");var C=e("meta[name=csrf-param]").attr("content");if(C&&N){l.extraData=l.extraData||{};l.extraData[C]=N}if(l.forceSync){k()}else{setTimeout(k,10)}var L,A,O=50,M;var D=e.parseXML||function(e,t){if(window.ActiveXObject){t=new ActiveXObject("Microsoft.XMLDOM");t.async="false";t.loadXML(e)}else{t=(new DOMParser).parseFromString(e,"text/xml")}return t&&t.documentElement&&t.documentElement.nodeName!="parsererror"?t:null};var P=e.parseJSON||function(e){return window["eval"]("("+e+")")};var H=function(t,n,r){var i=t.getResponseHeader("content-type")||"",s=n==="xml"||!n&&i.indexOf("xml")>=0,o=s?t.responseXML:t.responseText;if(s&&o.documentElement.nodeName==="parsererror"){if(e.error){e.error("parsererror")}}if(r&&r.dataFilter){o=r.dataFilter(o,n)}if(typeof o==="string"){if(n==="json"||!n&&i.indexOf("json")>=0){o=P(o)}else if(n==="script"||!n&&i.indexOf("javascript")>=0){e.globalEval(o)}}return o};return E}if(!this.length){s("ajaxSubmit: skipping submit process - no element selected");return this}var i,o,u,a=this;if(typeof r=="function"){r={success:r}}else if(r===undefined){r={}}i=r.type||this.attr2("method");o=r.url||this.attr2("action");u=typeof o==="string"?e.trim(o):"";u=u||window.location.href||"";if(u){u=(u.match(/^([^#]+)/)||[])[1]}r=e.extend(true,{url:u,success:e.ajaxSettings.success,type:i||e.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},r);var f={};this.trigger("form-pre-serialize",[this,r,f]);if(f.veto){s("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this}if(r.beforeSerialize&&r.beforeSerialize(this,r)===false){s("ajaxSubmit: submit aborted via beforeSerialize callback");return this}var l=r.traditional;if(l===undefined){l=e.ajaxSettings.traditional}var c=[];var h,p=this.formToArray(r.semantic,c);if(r.data){r.extraData=r.data;h=e.param(r.data,l)}if(r.beforeSubmit&&r.beforeSubmit(p,this,r)===false){s("ajaxSubmit: submit aborted via beforeSubmit callback");return this}this.trigger("form-submit-validate",[p,this,r,f]);if(f.veto){s("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this}var d=e.param(p,l);if(h){d=d?d+"&"+h:h}if(r.type.toUpperCase()=="GET"){r.url+=(r.url.indexOf("?")>=0?"&":"?")+d;r.data=null}else{r.data=d}var v=[];if(r.resetForm){v.push(function(){a.resetForm()})}if(r.clearForm){v.push(function(){a.clearForm(r.includeHidden)})}if(!r.dataType&&r.target){var m=r.success||function(){};v.push(function(t){var n=r.replaceTarget?"replaceWith":"html";e(r.target)[n](t).each(m,arguments)})}else if(r.success){v.push(r.success)}r.success=function(e,t,n){var i=r.context||this;for(var s=0,o=v.length;s<o;s++){v[s].apply(i,[e,t,n||a,a])}};if(r.error){var g=r.error;r.error=function(e,t,n){var i=r.context||this;g.apply(i,[e,t,n,a])}}if(r.complete){var y=r.complete;r.complete=function(e,t){var n=r.context||this;y.apply(n,[e,t,a])}}var b=e("input[type=file]:enabled",this).filter(function(){return e(this).val()!==""});var w=b.length>0;var E="multipart/form-data";var S=a.attr("enctype")==E||a.attr("encoding")==E;var x=t.fileapi&&t.formdata;s("fileAPI :"+x);var T=(w||S)&&!x;var N;if(r.iframe!==false&&(r.iframe||T)){if(r.closeKeepAlive){e.get(r.closeKeepAlive,function(){N=A(p)})}else{N=A(p)}}else if((w||S)&&x){N=L(p)}else{N=e.ajax(r)}a.removeData("jqxhr").data("jqxhr",N);for(var C=0;C<c.length;C++){c[C]=null}this.trigger("form-submit-notify",[this,r]);return this};e.fn.ajaxForm=function(t){t=t||{};t.delegation=t.delegation&&e.isFunction(e.fn.on);if(!t.delegation&&this.length===0){var n={s:this.selector,c:this.context};if(!e.isReady&&n.s){s("DOM not ready, queuing ajaxForm");e(function(){e(n.s,n.c).ajaxForm(t)});return this}s("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)"));return this}if(t.delegation){e(document).off("submit.form-plugin",this.selector,r).off("click.form-plugin",this.selector,i).on("submit.form-plugin",this.selector,t,r).on("click.form-plugin",this.selector,t,i);return this}return this.ajaxFormUnbind().bind("submit.form-plugin",t,r).bind("click.form-plugin",t,i)};e.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")};e.fn.formToArray=function(n,r){var i=[];if(this.length===0){return i}var s=this[0];var o=this.attr("id");var u=n?s.getElementsByTagName("*"):s.elements;var a;if(u&&!/MSIE [678]/.test(navigator.userAgent)){u=e(u).get()}if(o){a=e(':input[form="'+o+'"]').get();if(a.length){u=(u||[]).concat(a)}}if(!u||!u.length){return i}var f,l,c,h,p,d,v;for(f=0,d=u.length;f<d;f++){p=u[f];c=p.name;if(!c||p.disabled){continue}if(n&&s.clk&&p.type=="image"){if(s.clk==p){i.push({name:c,value:e(p).val(),type:p.type});i.push({name:c+".x",value:s.clk_x},{name:c+".y",value:s.clk_y})}continue}h=e.fieldValue(p,true);if(h&&h.constructor==Array){if(r){r.push(p)}for(l=0,v=h.length;l<v;l++){i.push({name:c,value:h[l]})}}else if(t.fileapi&&p.type=="file"){if(r){r.push(p)}var m=p.files;if(m.length){for(l=0;l<m.length;l++){i.push({name:c,value:m[l],type:p.type})}}else{i.push({name:c,value:"",type:p.type})}}else if(h!==null&&typeof h!="undefined"){if(r){r.push(p)}i.push({name:c,value:h,type:p.type,required:p.required})}}if(!n&&s.clk){var g=e(s.clk),y=g[0];c=y.name;if(c&&!y.disabled&&y.type=="image"){i.push({name:c,value:g.val()});i.push({name:c+".x",value:s.clk_x},{name:c+".y",value:s.clk_y})}}return i};e.fn.formSerialize=function(t){return e.param(this.formToArray(t))};e.fn.fieldSerialize=function(t){var n=[];this.each(function(){var r=this.name;if(!r){return}var i=e.fieldValue(this,t);if(i&&i.constructor==Array){for(var s=0,o=i.length;s<o;s++){n.push({name:r,value:i[s]})}}else if(i!==null&&typeof i!="undefined"){n.push({name:this.name,value:i})}});return e.param(n)};e.fn.fieldValue=function(t){for(var n=[],r=0,i=this.length;r<i;r++){var s=this[r];var o=e.fieldValue(s,t);if(o===null||typeof o=="undefined"||o.constructor==Array&&!o.length){continue}if(o.constructor==Array){e.merge(n,o)}else{n.push(o)}}return n};e.fieldValue=function(t,n){var r=t.name,i=t.type,s=t.tagName.toLowerCase();if(n===undefined){n=true}if(n&&(!r||t.disabled||i=="reset"||i=="button"||(i=="checkbox"||i=="radio")&&!t.checked||(i=="submit"||i=="image")&&t.form&&t.form.clk!=t||s=="select"&&t.selectedIndex==-1)){return null}if(s=="select"){var o=t.selectedIndex;if(o<0){return null}var u=[],a=t.options;var f=i=="select-one";var l=f?o+1:a.length;for(var c=f?o:0;c<l;c++){var h=a[c];if(h.selected){var p=h.value;if(!p){p=h.attributes&&h.attributes.value&&!h.attributes.value.specified?h.text:h.value}if(f){return p}u.push(p)}}return u}return e(t).val()};e.fn.clearForm=function(t){return this.each(function(){e("input,select,textarea",this).clearFields(t)})};e.fn.clearFields=e.fn.clearInputs=function(t){var n=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var r=this.type,i=this.tagName.toLowerCase();if(n.test(r)||i=="textarea"){this.value=""}else if(r=="checkbox"||r=="radio"){this.checked=false}else if(i=="select"){this.selectedIndex=-1}else if(r=="file"){if(/MSIE/.test(navigator.userAgent)){e(this).replaceWith(e(this).clone(true))}else{e(this).val("")}}else if(t){if(t===true&&/hidden/.test(r)||typeof t=="string"&&e(this).is(t)){this.value=""}}})};e.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=="function"||typeof this.reset=="object"&&!this.reset.nodeType){this.reset()}})};e.fn.enable=function(e){if(e===undefined){e=true}return this.each(function(){this.disabled=!e})};e.fn.selected=function(t){if(t===undefined){t=true}return this.each(function(){var n=this.type;if(n=="checkbox"||n=="radio"){this.checked=t}else if(this.tagName.toLowerCase()=="option"){var r=e(this).parent("select");if(t&&r[0]&&r[0].type=="select-one"){r.find("option").selected(false)}this.selected=t}})};e.fn.ajaxSubmit.debug=false})
</script>

<script src="js/plugins/Simple-Ajax-Uploader-master/SimpleAjaxUploader.js"></script>
<script src="js/list.min.js"></script>
<script src="js/plugins/wow/wow.min.js"></script>
<script src="js/plugins/dropzone/dropzone.js"></script>

<script src="js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script>

<!-- jquery UI -->
<script src="js/plugins/jquery-ui/jquery-ui.min.js"></script>

<!-- Clock picker -->
<script src="js/plugins/clockpicker/clockpicker.js"></script>

<!-- Chosen -->
<script src="js/plugins/chosen/chosen.jquery.js"></script>

<!-- Custom and plugin javascript -->
<script src="js/inspinia.js"></script>
<script src="js/plugins/pace/pace.min.js"></script> 

<!-- ChartJS-->
<script src="js/plugins/chartJs/Chart.min.js"></script>

<!-- Peity -->
<script src="js/plugins/peity/jquery.peity.min.js"></script>

<script src="js/plugins/toastr/toastr.min.js"></script>

<!-- Leaflet -->
<script src="js/plugins/leaflet/leaflet.js"></script>
<script src="js/plugins/Leaflet.label-master/src/Marker.Label.js"></script>
<script src="js/plugins/leaflet-locatecontrol-gh-pages/src/L.Control.Locate.js"></script>

<!-- Leaflet draw-master -->
<script src="js/plugins/Leaflet.draw-develop/src/Leaflet.draw.js"></script>
<script src="js/plugins/Leaflet.draw-develop/src/Leaflet.Draw.Event.js"></script>

<script src="js/plugins/Leaflet.draw-develop/src/Toolbar.js"></script>
<script src="js/plugins/Leaflet.draw-develop/src/Tooltip.js"></script>

<script src="js/plugins/Leaflet.draw-develop/src/draw/DrawToolbar.js"></script>
<script src="js/plugins/Leaflet.draw-develop/src/draw/handler/Draw.Feature.js"></script>
<script src="js/plugins/Leaflet.draw-develop/src/draw/handler/Draw.SimpleShape.js"></script>
<script src="js/plugins/Leaflet.draw-develop/src/draw/handler/Draw.Polyline.js"></script>
<script src="js/plugins/Leaflet.draw-develop/src/draw/handler/Draw.Marker.js"></script>
<script src="js/plugins/Leaflet.draw-develop/src/draw/handler/Draw.Circle.js"></script>
<script src="js/plugins/Leaflet.draw-develop/src/draw/handler/Draw.CircleMarker.js"></script>
<script src="js/plugins/Leaflet.draw-develop/src/draw/handler/Draw.Polygon.js"></script>
<script src="js/plugins/Leaflet.draw-develop/src/draw/handler/Draw.Rectangle.js"></script>

<script src="js/plugins/Leaflet.draw-develop/src/ext/GeometryUtil.js"></script>
<script src="js/plugins/Leaflet.draw-develop/src/ext/LatLngUtil.js"></script>
<script src="js/plugins/Leaflet.draw-develop/src/ext/LineUtil.Intersect.js"></script>
<script src="js/plugins/Leaflet.draw-develop/src/ext/Polygon.Intersect.js"></script>
<script src="js/plugins/Leaflet.draw-develop/src/ext/Polyline.Intersect.js"></script>
<script src="js/plugins/Leaflet.draw-develop/src/ext/TouchEvents.js"></script>

<script src="js/plugins/Leaflet.draw-develop/src/edit/EditToolbar.js"></script>
<script src="js/plugins/Leaflet.draw-develop/src/edit/handler/EditToolbar.Edit.js"></script>
<script src="js/plugins/Leaflet.draw-develop/src/edit/handler/EditToolbar.Delete.js"></script>

<script src="js/plugins/Leaflet.draw-develop/src/Control.Draw.js"></script>

<script src="js/plugins/Leaflet.draw-develop/src/edit/handler/Edit.Poly.js"></script>
<script src="js/plugins/Leaflet.draw-develop/src/edit/handler/Edit.SimpleShape.js"></script>
<script src="js/plugins/Leaflet.draw-develop/src/edit/handler/Edit.Rectangle.js"></script>
<script src="js/plugins/Leaflet.draw-develop/src/edit/handler/Edit.Marker.js"></script>
<script src="js/plugins/Leaflet.draw-develop/src/edit/handler/Edit.CircleMarker.js"></script>
<script src="js/plugins/Leaflet.draw-develop/src/edit/handler/Edit.Circle.js"></script>

<script src="js/plugins/Leaflet.EasyButton-master/src/easy-button.js" ></script>
<script src="js/plugins/Leaflet.markercluster/leaflet.markercluster-src.js" ></script>

<!-- Google map -->
<script src="https://maps.google.com/maps/api/js?key=AIzaSyBcOXamzcMVv4w0sCQBnXFaFjVwrL4k73E"></script>
<script src="js/plugins/leaflet-plugins-master/layer/tile/Google1.js"></script>

<!-- Jasny -->
<script src="js/plugins/jasny/jasny-bootstrap.min.js"></script>

<!-- jQuery UI custom -->
<script src="js/jquery-ui.custom.min.js"></script>

<!-- iCheck -->
<script src="js/plugins/iCheck/icheck.min.js"></script>

<!-- Data picker -->
<script src="js/plugins/datapicker/bootstrap-datepicker.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/1000hz-bootstrap-validator/0.11.5/validator.min.js"></script>

<!-- Gantt -->
<script src="gantt/dhtmlxgantt.js" type="text/javascript" charset="utf-8"></script>

<!-- Sweet alert -->
<script src="js/plugins/sweetalert/sweetalert.min.js"></script>

<!-- Include SmartWizard JavaScript source -->
<script type="text/javascript" src="js/plugins/SmartWizard/jquery.smartWizard.min.js"></script>

<!-- FooTable -->
<script src="js/plugins/footable/footable.all.min.js"></script>

<!-- Typehead -->
<script src="js/plugins/typehead/bootstrap3-typeahead.min.js"></script>

<!-- SUMMERNOTE -->
<script src="js/plugins/summernote/summernote.min.js"></script>

<script type="text/javascript" src="js/plugins/jQuery-iviewer/test/jquery.mousewheel.min.js"></script>
<script type="text/javascript" src="js/plugins/jQuery-iviewer/jquery.iviewer.js" ></script>

<!-- clipboard -->
<script src="js/clipboard.min.js"></script>

<!-- Dual Listbox -->
<script src="js/plugins/dualListbox/jquery.bootstrap-duallistbox.js"></script> 

<script src="js/dhtmlxscheduler.js" type="text/javascript" charset="utf-8"></script>
<script src="js/dhtmlxscheduler_minical.js" type="text/javascript" charset="utf-8"></script>

<script src="js/dhtmlxscheduler_timeline.js" type="text/javascript" charset="utf-8"></script>
<script src="js/dhtmlxscheduler_treetimeline.js" type="text/javascript" charset="utf-8"></script>

<!-- custom Js -->
<script src="js/crm_1_5_055.js"></script>
<script src="js/conatiner_loading.js"></script>

<!-- Data table -->
<script src="js/plugins/dataTables/datatables.min.js"></script>

crm_1_5_055.js

function tasks() {
hideAll();

$("#db_tasks").removeClass("hide");
titleMenuManag("Task Management","btn_tasks");

var filtre = document.getElementById('srch-tasks').value;  

document.getElementById('task_gantt').innerHTML = '<div class="h1 m-t-xs text-navy"><span class="loading"></span></div>'; 

var resurl='include/task.php?elemid=tasks_gantt&filtre='+filtre; 
var xhr = getXhr();
xhr.onreadystatechange = function(){
	if(xhr.readyState == 4 ){
		leselect = xhr.responseText;     
		
		if(leselect == ""){
			document.getElementById('task_gantt').innerHTML = '<i class="fa fa-exclamation-triangle"></i> No data'; 
		} else {
		
			gantt.init("task_gantt");
			gantt.clearAll();
			
			gantt.load("https://icoop.live/ic/gantt/gantt_task.php");
	
			var dp = new dataProcessor("https://icoop.live/ic/gantt/gantt_task.php");
			dp.init(gantt);
			
			
			if(filtre==""){
				scaleConfigs = [
					// minutes
					{ unit: "minute", step: 1, scale_unit: "hour", date_scale: "%H", subscales: [
						{unit: "minute", step: 1, date: "%H:%i"}
					]
					},
					// hours
					{ unit: "hour", step: 1, scale_unit: "day", date_scale: "%j %M",
						subscales: [
							{unit: "hour", step: 1, date: "%H:%i"}
						]
					},
					// days
					{ unit: "day", step: 1, scale_unit: "month", date_scale: "%F",
						subscales: [
							{unit: "day", step: 1, date: "%j"}
						]
					},
					// weeks
					{unit: "week", step: 1, scale_unit: "month", date_scale: "%F",
						subscales: [
							{unit: "week", step: 1, template: function (date) {
								var dateToStr = gantt.date.date_to_str("%d %M");
								var endDate = gantt.date.add(gantt.date.add(date, 1, "week"), -1, "day");
								return dateToStr(date) + " - " + dateToStr(endDate);
							}}
						]},
					// months
					{ unit: "month", step: 1, scale_unit: "year", date_scale: "%Y",
						subscales: [
							{unit: "month", step: 1, date: "%M"}
						]},
					// quarters
					{ unit: "month", step: 3, scale_unit: "year", date_scale: "%Y",
						subscales: [
							{unit: "month", step: 3, template: function (date) {
								var dateToStr = gantt.date.date_to_str("%M");
								var endDate = gantt.date.add(gantt.date.add(date, 3, "month"), -1, "day");
								return dateToStr(date) + " - " + dateToStr(endDate);
							}}
						]},
					// years
					{unit: "year", step: 1, scale_unit: "year", date_scale: "%Y",
						subscales: [
							{unit: "year", step: 5, template: function (date) {
								var dateToStr = gantt.date.date_to_str("%Y");
								var endDate = gantt.date.add(gantt.date.add(date, 5, "year"), -1, "day");
								return dateToStr(date) + " - " + dateToStr(endDate);
							}}
						]},
					// decades
					{unit: "year", step: 10, scale_unit: "year", template: function (date) {
						var dateToStr = gantt.date.date_to_str("%Y");
						var endDate = gantt.date.add(gantt.date.add(date, 10, "year"), -1, "day");
						return dateToStr(date) + " - " + dateToStr(endDate);
					},
					subscales: [
						{unit: "year", step: 100, template: function (date) {
							var dateToStr = gantt.date.date_to_str("%Y");
							var endDate = gantt.date.add(gantt.date.add(date, 100, "year"), -1, "day");
							return dateToStr(date) + " - " + dateToStr(endDate);
						}}
					]}
				];
			}
		}

		leselect = xhr.responseText;
	}
};

xhr.open("GET",resurl,true);
xhr.send(null);

}

tasks();

gantt_task.php

<?php include('connector/gantt_connector.php'); include('connector/options_connector.php'); require("connector/db_postgre.php"); $dbtype="Postgre"; $postrgre_connection = "host=host port=5433 dbname=db_name user=db_user password=db_password"; $res=pg_connect($postrgre_connection); $gantt = new JSONGanttConnector($res, $dbtype); $gantt->render_sql("SELECT project_name, id_project, to_char(start_date::timestamp with time zone, 'dd-mm-yyyy'::text) AS start_date, to_char(due_date::timestamp with time zone, 'dd-mm-yyyy'::text) AS end_date, (due_date - start_date) AS duration FROM project WHERE project_type=490 ORDER BY id_project DESC","id_project","start_date,end_date,project_name,duration"); Thanks

#4

Hello Christoph,
Thank you for sending me part of your code. But I couldn’t reproduce the issue as I don’t have all the scripts and functions you use. For example, I don’t have getXhr(); function.

I tried to add Gantt and Scheduler on the same page, and there is no error message when I update tasks and events:
http://snippet.dhtmlx.com/eba64f0d4

Please, send me your full archived project with all necessary javascript files. Or send me a full archived project with all necessary files where I can reproduce the issue locally.


#5

Hello remi,
thanks a lot for you effort those are the files and this is to have a look

the update has no effect to the database and gives me in console the error i have posted.

app.js (2.7 KB)

Thanks.


#6

This is the index.php

index.php (25.2 KB)


#7

this is the db connection file

gantt_task.php (743 Bytes)


#8

Hello Christoph,
Thank you for sending me the files and for giving me the link.
I was able to reproduce the issue. Looks like you have an old Gantt version(4.1). I tried Gantt 6.1.1, there is no such error.
And also, you need to define the Data Processor as gantt.dataProcessor():

var dp = new gantt.dataProcessor("gantt_task.php");