This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Accounting = SC.Application.create( | |
NAMESPACE: 'Accounting', | |
VERSION: '0.1.0', | |
store: SC.Store.create(), | |
currentPage:'Accounting.invoices.mainView', | |
loadInvoices:function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contact: function() { | |
var query = SC.Query.local(AccountingModel.Contact, 'id=%@'.fmt(this.get('contact_id'))); | |
return this.get('store').find(query).firstObject(); | |
}.property().cacheable(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_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'); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contact: function() { | |
var S = this.get('store'); | |
return S.materializeRecord(S.storeKeyFor(AccountingModel.Contact, this.get('contact_id'))); | |
}.property('contact_id'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |