Created
February 26, 2011 13:09
-
-
Save MikailCliftov/845174 to your computer and use it in GitHub Desktop.
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
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); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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();
}