So I'm doing this in my AppView
var flowerModel = new app.DataModel({title: "flower", values: ["tulip","rose","dandelion"], dataToShow:["tulip", "rose", "dandelion"], data: data});
var timelineModel = new app.TimeChartModel({data: flowerModel.getDisplayedData(), titlesToShow: flowerModel.get('dataToShow')});
tableCollection.add(flowerModel);
var timechart = d3.select("body").append("div").attr("class","timechart");
this.centerView = new app.TimeChartView({model: flowerModel, el : timechart});
this.rightView = new app.TableView({model: flowerModel});
In my TimeChartView init method I do this-
initialize: function(){
this.model.bind('change','render');
//other, irrelevant things
}
and in my flowerModel I have this method, which works when a checkbox is ticked -
events: {
'click .data-type' : 'collapseDatum',
'click .show-datum' : 'addDatumToShow',
},
addDatumToShow: function(e){
var test = $(this.$el).find(".datum-list").find(":checked");
newDataToShow = [];
_.each(test, function(value,key,list){
var title = $(value).data("title");
newDataToShow.push(title);
});
this.model.set("dataToShow", newDataToShow);
},
The error happens on the this.model.set('dataToShow', newDataToShow).
I'm really not sure why and any advice on how to debug would be helpful. I don't think I'm doing anything crazy, or unusual here.