Skip to content

Instantly share code, notes, and snippets.

01:18 < KU0N> Now, how can I notify a view from a model?
01:18 < KU0N> The thing is, I have a complex view that manage a timeline http://www.simile-widgets.org/timeline/
01:19 < KU0N> now, when a model is deleted, I need to notify that view so it can reload the timeline from the server
01:19 < KU0N> I must trigger the reload after the server finished deleting the object
01:19 < KU0N> so I have didDestroy called on my model by my datasource
01:20 < KU0N> now what would be the best way, from my model didDestroy method, to notify my view?
Accounting = SC.Application.create(
NAMESPACE: 'Accounting',
VERSION: '0.1.0',
store: SC.Store.create(),
currentPage:'Accounting.invoices.mainView',
loadInvoices:function() {
list: SC.ScrollView.design({
layout:{width:250},
contentView: SC.ListView.design({
contentBinding:"Accounting.invoicesController.arrangedObjects",
selectionBinding:"Accounting.invoicesController.selection",
rowHeight:70,
exampleView:SC.View.design(SC.Control, SC.ContentDisplay, {
contentDisplayProperties:"contact".w(),
classNames:"invoice-item",
render:function (ctx) {
list: SC.ScrollView.design({
layout:{width:250},
contentView: SC.ListView.design({
contentBinding:"Accounting.invoicesController.arrangedObjects",
selectionBinding:"Accounting.invoicesController.selection",
rowHeight:70,
exampleView:SC.View.design(SC.Control, {
classNames:"invoice-item",
displayProperties:'content.contact',
render:function (ctx) {
contact: function() {
var query = SC.Query.local(AccountingModel.Contact, 'id=%@'.fmt(this.get('contact_id')));
return this.get('store').find(query).firstObject();
}.property().cacheable(),
_findRecord: function(recordType, id) {
var storeKey ;
// if a record instance is passed, simply use the storeKey. This allows
// you to pass a record from a chained store to get the same record in the
// current store.
if (recordType && recordType.get && recordType.get('isRecord')) {
storeKey = recordType.get('storeKey');
contact: function() {
var S = this.get('store');
return S.materializeRecord(S.storeKeyFor(AccountingModel.Contact, this.get('contact_id')));
}.property('contact_id'),
Accounting.InvoiceEntryItemView = SC.View.extend(SC.Control,{
classNames:"invoice-entry-item",
acceptsFirstResponder:YES,
alternateClass:function() {
return this.get('contentIndex') % 2 === 0 ? "even" : "odd";
}.property('contentIndex'),
_accountChanged:function() {
this.displayDidChange();
}.observes('*content.account.number'),
Feb 1 23:34:15 vm1 kernel: device-mapper: multipath: Failing path 8:64.
Feb 1 23:34:15 vm1 multipathd: sde: readsector0 checker reports path is down
Feb 1 23:34:15 vm1 multipathd: checker failed path 8:64 in map 3600a0b800075bd86000002904d46ce98
Feb 1 23:34:15 vm1 multipathd: Path event for 3600a0b800075bd86000002904d46ce98, calling mpathcount
Feb 1 23:34:15 vm1 multipathd: 3600a0b800075bd86000002904d46ce98: remaining active paths: 1
Feb 1 23:34:20 vm1 multipathd: sde: readsector0 checker reports path is up
Feb 1 23:34:20 vm1 multipathd: 8:64: reinstated
Feb 1 23:34:20 vm1 multipathd: 3600a0b800075bd86000002904d46ce98: remaining active paths: 2
Feb 1 23:34:20 vm1 multipathd: Path event for 3600a0b800075bd86000002904d46ce98, calling mpathcount
@kuon
kuon / gist:838826
Created February 22, 2011 15:23
slickgrid with sproutcore
SGUI.TableView = SC.CollectionView.extend({
columns:[],
options:{},
reloadIfNeeded:function() {
var options = this.get('options');
var content = this.get('content');
var columns = this.get('columns');
function getItem(index) {