Skip to content

Instantly share code, notes, and snippets.

@MikailCliftov
Created February 26, 2011 13:09
Show Gist options
  • Save MikailCliftov/845174 to your computer and use it in GitHub Desktop.
Save MikailCliftov/845174 to your computer and use it in GitHub Desktop.
Rapid.checkDataDefinitionController = SC.ObjectController.create(
SC.CollectionViewDelegate,{
nestedStore: null,
checkStore: function(){
if (this.get('nestedStore')){
//nestedStore is not null
}else{
this.nestedStore = Rapid.store.chain();
//this.set('nestedStore', nestedStore);
}
},
createNew: function(){
this.checkStore();
var cdd = this.nestedStore.createRecord(Rapid.CheckDataDefinition, {});
this.set('content', cdd);
},
saveDefinition: function(){
this.checkStore();
var defns = this.get('content');
this.nestedStore.commitChanges(YES);
var crud = Rapid.store.find(defns);
crud.commitRecord();
var pk = Rapid.checkTypeController.get('id');
var checkType = Rapid.store.find(Rapid.CheckType, pk);
checkType.get('checkDataDefinitions').pushObject(defns);
}
});
@floriankugler
Copy link

saveDefinition: function(){
this.checkStore();
var defns = this.get('content');
this.nestedStore.commitChanges(YES);
Rapid.checkTypeController.get('checkDataDefinitions').pushObject(Rapid.store.find(defns));
Rapid.store.commitRecords();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment