Say, we are given the following JSON data:
graphlist =
"graph1" :
"name" : "Graph 1"
"graph2" :
"name" : "Graph 2"
We then construct a Batman.Set of Batman.Objects in the following way:
a = new Batman.Set
for key, data of graphlist
a.add new Batman
"key" : key
"name" : data.name
"enabled" : true
Let's say we now save this in our controller. For example:
@set 'graphs', a
Now, in the (JADE driven) view, we can bind to an element
td(data-foreach-graph="controllers.graphcontroller.graphs")
input(type="checkbox",data-source="graph.enabled")
What if we wanted to observe any changes in the controller. I've tried adding this line to the controller ...
@observe 'graphs', (newVal, oldVal) ->
console.log "Value changed"
... and toggling the checkbox doesn't seem to trigger the callback.
Am I doing something wrong?
Thanks
Andrew
Sorry, I noticed that I made a mistake in my explanation. The JADE view uses "data-bind", and not "data-source". Regardless of which one I use, the callback doesn't seem to work.
--
You received this message because you are subscribed to the Google Groups "batman.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to batmanjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.