|
CalendarXP.net Support Most forums here are private and invisible to public.
|
View previous topic :: View next topic |
Author |
Message |
calendarxp Site Admin
Joined: 30 Jan 2005 Posts: 409
|
Posted: Wed Oct 03, 2007 10:05 pm Post subject: How to load agenda events using csv file instead of javascript js file? |
|
|
By default, the standard way to load agenda is adding fAppendEvent() calls in the agenda.js. It's not very intuitive especially for non-programmers.
Actually, we can write the events in csv file (can be edited directly using MS Excel) and load it via the fLoadScript() function and then translate it into fAppendEvent() calls in javascript. You just need:
1. create a csv file in the same directory with agenda.js, e.g. events.csv
2. add the following code to agenda.js:
Code: | function parseCsvAgenda(req) {
var csvText = req.responseText;
var EventData=csvText.split("\n");
for(i=0;i<EventData.length;i++) {
var e=EventData[i].split(",");
fAppendEvent(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10]);
}
fRepaint(); // refresh screen after loading finished
}
fLoadScript("/path/to/events.csv", parseCsvAgenda); |
_________________ Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved.
Last edited by calendarxp on Tue Feb 02, 2010 6:54 pm; edited 2 times in total |
|
Back to top |
|
|
amcgibbon
Joined: 29 Dec 2009 Posts: 13
|
Posted: Wed Jan 27, 2010 6:01 pm Post subject: |
|
|
I'm trying to get this to work but have not been able to. Can anyone tell me what the field names need to be in the CSV so that they are pulled in?
|
|
Back to top |
|
|
calendarxp Site Admin
Joined: 30 Jan 2005 Posts: 409
|
Posted: Fri Jan 29, 2010 7:38 pm Post subject: |
|
|
You don't need to name any field/column. But you do need to arrange the fields/columns in the following sequence(leave field empty if no value):
Code: | year, month, day, message, action, bgcolor, fgcolor, bgimg, boxit, html, etc |
_________________ Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
Copyright 2003- Idemfactor Solutions, Inc. All rights reserved.
Powered by phpBB © 2001, 2005 phpBB Group
|