Skip to content

Instantly share code, notes, and snippets.

@skizzybiz
Created April 25, 2011 20:36
Show Gist options
  • Save skizzybiz/941164 to your computer and use it in GitHub Desktop.
Save skizzybiz/941164 to your computer and use it in GitHub Desktop.
SC.ready(function() {
var records;
MT.mainPane = SC.TemplatePane.append({
layerId: 'my_app',
templateName: 'my_app'
});
records = MT.MyRecord.originals();
MT.myRecords.set('content', records);
return MT.myRecords.selectObject(records.objectAt(0));
});
MT.myRecords = SC.ArrayController.create({
content: [],
selection: null,
});
MT.MyRecordsListView = SC.TemplateCollectionViewWithSelection.extend({
contentBinding: 'MT.myRecords.content',
selectionBinding: 'MT.myRecords.selection'
});
SC.TemplateCollectionViewWithSelection = SC.TemplateCollectionView.extend({
arrayContentDidChange: function() {
console.log("arrayContentDidChange");
return sc_super();
},
selectionDidChange: (function() {
var content, idx, item, selected;
console.log("selectionDidChange");
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment