Customizing the event Properties

Hi first of all it’s an amazing event schedualer :slight_smile:
I used it in ASP.NET MVC Application
I was wondering if we can add more properties to the event class , I want to add RSVP collection property to the event
and display them as a tool tip when hovering the event . of course tooltip is ready and easy to implemented in this calender
but I tried to get the rsvps for each event and I got XML ERROR the DATA.aspx View is like the this :

<% foreach (var myevent in Model) { %> ]]> ]]> ]]> <% if (myevent.rsvps.Count > 0) { %> <% foreach (var rsvp in myevent.rsvps) { %> ]] <%} %> <%} %> <% } %>

It may be caused by

a) special chars in rsvp.id - which you are storing as attribute
b) data encoding, if its non utf-8 - it may cause an error

If issue still occurs for you - please provide a sample of problematic xml

it seems that data.aspx must not be changed at all because whenever I add property
like

the Error raised ? I think I can’t change this XML Schema at all

if not could you provide me an example ?

Client side code doesn’t care about XML format, while it has a valid syntax - any structure will work.

Please provide a sample of problematic xml if issue still occurs.

here is the sample sir and thanks for you fast response ! :smiley:
scheduler_aspnet_mvc_modifiedforRSVP.rar (456 KB)

Code looks correct - can you try to run the code locally, and load

/Calendar/Data

in the separate window of browser.
If xml somehow mailformed - it will provide the extended error info.

thanks a lot for reminding me to check the xml file in this way

yes my friend I got the error which is very silly and small !!!

I just forgot to close the tag of CDATA in rsvp_name !!! oh my god this error caused a lot of pain to me

thanks a gain I will continue checking if I can read this xml data in java script to put them
in tool tip

regards ,

<% foreach (var myevent in Model) { %> ]]> ]]> ]]> <% if (myevent.rsvps.Count > 0) { %> <% foreach (var rsvp in myevent.rsvps) { %> ]][b][u]>[/u][/b] <%} %> <%} %> <% } %>

ok I tried to read the rsvp name from the arrays but again undefined string appeared

I know that My question is about javascript but could you read this code please :

scheduler.templates.tooltip_text = function (start, end, event) {
var str = "Event: " + event.text + "
Start date: " + scheduler.templates.tooltip_date_format(start) + “
End date: " + scheduler.templates.tooltip_date_format(end) + "
go to detail”;
str += “


” ;
for (var i in event.rsvps) {
//var rsvp = event.rsvps[i];
alert(event.rsvps[i].rsvp_name);
str += event.rsvps[i].rsvp_name + "
";
}
return str;
}

Include the attached patch on the page after scheduler.js ( or to the end of scheduler.js )
It will improve xml parsing logic a bit, with it you will be able to access extra info as

event.rsvps[0].rsvp[0].rsvp_name

The patch in question
patch.zip (413 Bytes)

thanks a lot I tested it but it doesn’t work could you explain to me the function of this patch file
I just added the file to the page as link

or do you mean to add the code to inside schedualar file ???

thanks

or do you mean to add the code to inside schedualar file ???
Yep, better add its content to the end of dhtmlxscheduler.js

Without patch scheduler will not work correctly with multi-level nested XML data. ( it will not be correctly mapped to js object )

I added the method to the end of the file but it’s not working my friend
?

Check the attached sample.
1297777050.zip (48.5 KB)

thanks a lot sir I really appreciate that . I will check the sample then I will answer you

it works like a charm my friend thanks a lot

I have some notices : according to the Data File I put the Tree tags like this :

the rsvps is array with one item always and the rsvp is also array with many items

why’s that I expected the rsvps will be array with many rsvp so I can write the javascript like this

scheduler.templates.tooltip_text = function (start, end, event) {
var str = "Event: " + event.text + "
Start date: " + scheduler.templates.tooltip_date_format(start) + “
End date: " + scheduler.templates.tooltip_date_format(end) + "
go to detail”;
str += “


”;
for (var i = 0; i < event.rsvps.length; i++) {
str += event.rsvps[i].rsvp_name + "
";
}
return str;
}

but the code above is wrong and I wrote as you told me :

scheduler.templates.tooltip_text = function (start, end, event) {
var str = "Event: " + event.text + "
Start date: " + scheduler.templates.tooltip_date_format(start) + “
End date: " + scheduler.templates.tooltip_date_format(end) + "
go to detail”;
str += “


”;
for (var i = 0; i < event.rsvps[0].rsvp.length; i++) {
str += event.rsvps[0].rsvp[i].rsvp_name + "
";
}
                return str;
            }

everythings works well now but is there any explaination for that ?
is this java script issues or the path file issue (you sent me)

thanks a lot

everythings works well now but is there any explaination for that ?
The logic of xml-to-json conversion is pretty simple
Attributes and text containing sub-tags are counted as object properties
Subtags with complex content always presented as collections of objects (arrays).

ok thanks I got the idea :slight_smile: