Loading options dynamically without dataProcessor?

Hello,

I’ve been doing some tests with the scheduler component, and I find it incredibly useful. I am currently attempting to use it in an application for which I do not have much access. I would like to be able to load options dynamically from the db, but I can’t seem to figure out how.

Currently, I am attempting to do this:
var employees = scheduler.serverList(“employees”);
scheduler.createTimelineView({
section_autoheight: false,
name: “timeline”,
x_unit: “day”,
x_date: “%d %M”,
x_step: 1,
x_size: 7,
x_start: 0,
y_unit: employees,
y_property: “employee”,
render: “tree”,
folder_events_available: true,
dy:35
});

scheduler.load(["?activity=GetData&type=Events", “?activity=GetData&type=Employees”]);

The first load returns the events (this works), the second is supposed to load the employees, but this isn’t working. I can’t use any of the java/jsp/c#/php connectors, I’m basically making my own connector, but I can’t seem to get it to work.

Any help is much appreciated

Hello,

So you are forming resulting XML yourself, right?
If that’s the case you can use only single call and the response should be like following sample:

<?xml version='1.0' encoding='utf-8' ?> <data> <event id="108"> <start_date><![CDATA[2009-11-05 10:15:00]]></start_date> <end_date><![CDATA[2009-11-05 13:35:00]]></end_date> <text><![CDATA[User: Nataly, Fruits: Madarin, Pineapple]]></text> <details><![CDATA[Tokyo]]></details> </event> <event id="107"> <start_date><![CDATA[2009-11-03 14:05:00]]></start_date> <end_date><![CDATA[2009-11-03 16:15:00]]></end_date> <text><![CDATA[Users: George, Diana; Fruits: Orange, Kiwi, Plum]]></text> <details><![CDATA[Belgium]]></details> </event> <coll_options for="user_id"> <item label="George" value="1"/> <item label="Nataly" value="2"/> <item label="Diana" value="3"/> <item label="Adam" value="5"/> </coll_options> <coll_options for="fruit_id"> <item label="Orange" value="1"/> <item label="Banana" value="2"/> <item label="Peach" value="3"/> <item label="Kiwi" value="4"/> <item label="Plum" value="5"/> <item label="Grapefruit" value="6"/> <item label="Lime" value="7"/> <item label="Lemon" value="8"/> <item label="Mandarin" value="9"/> <item label="Pineapple" value="10"/> </coll_options> </data>
Please note <coll_options for=“user_id”>
With it you can use

users = scheduler.serverList("user_id"); 

in your code.

Kind regards,
Ilya

So this is a great start. Is there any way to do it with multiple calls, by chance? Or would I simply use the multi-data-source extension, and they will all get combined?

Also - What other options than coll_options do I have? In my example i’d be returning a JSON tree structure for the ‘matrix’ view.

I’m very close! Everything is working except the ‘tree’ aspect. Here’s the XML i’m returning:

...Event...

I am expecting this:
A

  • B
  • C
    • D
    • E

But I get this:
A
B
C
D
E

Any hints?

Unfortunately only one-level options can be loaded in such way, not hierarchical ones.

You can load the set of options by separate ajax call, as json or any other format, and later, use scheduler.updateCollection method to refresh collection with new values.

Also, there is separate api calls for hierarchical sections
Check Tree-Timeline section at docs.dhtmlx.com/doku.php?id=dhtm … _reference

Thanks,

I ended up returning the JSON for my tree as an extra attribute on an option, and eval’ing it onOptionsLoad. That seems to do the trick!

Thanks.

Maybe in future versions you might look at expanding coll_options for tree data?