Zallist / TimeScheduler

A simple JavaScript Timeline Scheduler library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Any idea how this would work with knockout.js?

asleg opened this issue · comments

commented

Hi and thank for a brilliant piece of sw.
I´d like to utilise this together with knockout.
Say I´ve got a list of task that I can update either in the calendar view or the list view.
I´d like to sett task title, subtitle, responsible, duration etc.
I also liked the calendar to respond to new tasks created in the list.
Any thoughts on this?

Since this is almost entirely JavaScript, you would have to "subscribe" to
your array in Knockout, then trigger a calendar update on change. The
calendar Get function would need to be changed to pull from the array.

As an aside, this library will break for a day or 2 over the next week
because of Daylight Savings Time. This is only a frontend issue, but I
don't have time to fix it for a while.
On 23 Oct 2014 21:07, "Asle" notifications@github.com wrote:

Hi and thank for a brilliant piece of sw.
I´d like to utilise this together with knockout.
Say I´ve got a list of task that I can update either in the calendar view
or the list view.
I´d like to sett task title, subtitle, responsible, duration etc.
I also liked the calendar to respond to new tasks created in the list.
Any thoughts on this?


Reply to this email directly or view it on GitHub
#10.

commented

Thanks for your quick answer, Zallist.

I guess by the Get function you mean the Calendar. GetSections() ?

I´ll make Items an observableArray in my view model like this:
...
var self = this;
self.Items = ko.observableArray();
// fill sell.Items here...
...
But wouldn´t I need to write a ko.bindinghandler to Calendar as well?
Or to TimeScheduler?

Something like the solution here: http://www.codeproject.com/Tips/780329/Bootstrap-datepicker-and-Knockout-model-binding

?

No, you would add a Subscribe to your ObservableArray, which would then
trigger an event whenever the array changed. The scheduler will be set up
so that the Get events (sections and items) pulled data from your
ObservableArrays.
You would call TimeScheduler.FillSections or TimeScheduler.FillSchedule.
On 24 Oct 2014 09:42, "Asle" notifications@github.com wrote:

Thanks for your quick answer, Zallist.

I guess by the Get function you mean the Calendar. GetSections() ?

I´ll make Items an observableArray in my view model like this:
...
var self = this;
self.Items = ko.observableArray();
// fill sell.Items here...
...
But wouldn´t I need to write a ko.bindinghandler to Calendar as well?
Or to TimeScheduler?

Something like the solution here:
http://www.codeproject.com/Tips/780329/Bootstrap-datepicker-and-Knockout-model-binding

?


Reply to this email directly or view it on GitHub
#10 (comment)
.

commented

So something like:
self.Items = ko.observableArray()
//self.Items.push(something)

self.Items.subscribe( function(item) {
    TimeScheduler.FillSections();
});

?

Does TimeSchedular allow editing today, i.e. would this work:
item.name = ´

<input data-bind=value: title" />
subtitle something...
´

where title is an observable?