hi,
i want to implement dhtmlx scheduler with timline in our rails application.
we want to load the section from the db.
can i load the section like the ‘events’?
controller:
def records
@records = Mainplan.all
respond_to do |format|
format.xml
end
end
records.xml.builder:
xml.instruct! :xml, :version=>"1.0"
xml.tag!("data") do #actual count of records need to be used here
@records.each do |record|
xml.tag!("event",{ "id" => record.id }) do
xml.tag!("text", record.note)
xml.tag!("start_date", record.datum)
xml.tag!("end_date", record.datum_end)
xml.tag!("section_id", [i]SomeTableCall.find.id[/i])
end
end
end
show.html.erb
....
scheduler.init('scheduler_here',new Date(),"timeline");
scheduler.load("/records");
That part is working fine.
Know i want the same for the section:
controller:
def sections
@sections= Mainplan.all
respond_to do |format|
format.xml
end
end
sections.xml.builder:
xml.instruct! :xml, :version=>"1.0"
xml.tag!("data") do #actual count of records need to be used here
@sections.each do |section|
xml.tag!("sections",{ "id" => section.id }) do
xml.tag!("key", section.id)
xml.tag!("label", section.note)
end
end
end
show.html.erb
....
scheduler.load("sections");
var sections = [
??
]
please help me