render_table, render_sql trouble

Hello,

I am trying to get data from a MySQL view into dhtmlxScheduler. I have tried two approaches and neither works. When I try to use the render_table function and browse directly to my connector.php (called datasched.php in my case) I see my array of data returned as expected but three of the four fields are wrapped in CDATA tags. Apparently XML just ignores the contents of these tags so I get no data in dhtmlxScheduler. When I use the render_sql function I get the same results - fields wrapped in CDATA tags.

The interesting thing is that I have tried the exact same render_sql statement using the same MySQL table with dhtmlxGantt and everything works perfectly. The data is returned without CDATA tags and is displayed as expected in dhtmlxGantt. (Actually, I would prefer to use dhtmlxGantt but I need to display multiple independent tasks on one line.)

So, why can’t I get dhtmlxScheduler to work with my data just like dhtmlxGantt does? What do I need to do differently?

Thanks in advance for your help.

John

Do you have CDATA wrapped text directly in DB or as result of connector ?
In second case - that is perfectly fine, and must be processed by client side code correctly.

If issue still occurs for you - please provide a sample of problematic data.
Also, both Scheduler and Gantt supports loading from json, and both have related json connector classes - so you can try to use json instead of XML

Hi Stanislav,

Thanks for the quick reply.

Here is a portion of what is returned when I browse directly to my connector.php file.

[code]

<start_date>

</start_date>
<end_date>

</end_date>

<![CDATA[ 0054 Depot ]]> <![CDATA[ 1556 Depot ]]> [/code]

My date config is as follows: scheduler.config.xml_date="%Y-%m-%d";

I definitely have data in my database as the gantt chart reads and displays everything perfectly.

If there is any other information you need to help me solve this please let me know.

Thanks again for your help.

John

Hi again Stanislav,

I want to respond and add that CDATA tags are a result of the connector.

Thanks,

John

It looks as a data generated by SchedulerConnector, for gantt you need to use GanttConnector.
While in above XML data tag named “event” in case of gantt connector it will be “task”

<data> <task id="1">

Thanks Stanislav,

Sorry for any confusion but I am trying to display data in Scheduler. (I am using two connector files which are different. I call gantt_connector which allows me to connect and display data in Gantt and works perfectly. And yes, my Gantt connector produces task id = "1" . When I call schedule_connector Scheduler does not display anything but based on your response it appears to be setup correctly.) According to your last answer, the XML file that I reference in this thread which shows event id = "1" is setup correctly to display in Scheduler. So why doesn’t Scheduler display anything?

John

Thanks for explanation.

Data for scheduler looks mostly fine, this is copy-paste from browser, right ?
Normally it must be like next

<data> <event id="135"> <start_date><![CDATA[2014-11-13]]>

  • no whitespace between CDATA and tag
  • no whitespace inside of CDATA

Browser can add some whitespaces and new lines while checking XML in browser ( if you check source of such xml page - it must show correct data without whitespaces )

Thanks Stanislav,

Apparently the whitespace is due to the browser.

Here is a sample of the page source -

<?xml version='1.0' encoding='utf-8' ?><data><event id='135'><start_date><![CDATA[2014-11-13]]></start_date><end_date><![CDATA[2014-11-20]]></end_date><text><![CDATA[<a href=http://xyz.preflightinfo.com/index.php/acdepot?tailno=0054&cfid=&mnthbk=0>0054 Depot</a>]]></text><color><![CDATA[red]]></color></event> <event id='60'><start_date><![CDATA[2014-10-23]]></start_date><end_date><![CDATA[2014-10-30]]></end_date><text><![CDATA[<a href=http://xyz.preflightinfo.com/index.php/acdepot?tailno=1556&cfid=&mnthbk=0>1556 Depot</a>]]></text><color><![CDATA[red]]></color></event>

So, as you can see there does not appear to be any whitespace in the xml. So what else could be the problem? It seems like it should work.

Thanks again for all of your help so far!

John

Hi Stanislav,

The issue was not with the data but was due to a careless configuration error. I had an extra space in the y_property id name. Everything worked immediately as soon as the space was removed. I had set y_property: "id ", and then corrected it to read y_property: “id”,

Thanks again for your help and a great product!

John