Skip to content

Instantly share code, notes, and snippets.

View MikailCliftov's full-sized avatar

MikailCliftov

View GitHub Profile
I'm trying to reuse a query object:
var q = this._q;
if (!q){
q = this._q = SC.Query.create({
recordType: Rapid.Application
});
}
q.set('conditions', 'currentStep = %@');
q.set('parameters', [this.get('content')]);
Creating the record:
var record = Rapid.store.createRecord(Rapid.Check, {
guid: '@123'
});
relationA.get('checks').pushObject(record);
... set up an observer on record status
Rapid.store.commitRecords();
the record is created, but relationA.checks points to @123 instead of the storeKey's id (1000)
MyApp.aSimpleController= SC.ObjectController.create({
contentBinding : SC.Binding.single('MyApp.anArrayController.selection')
});
MyApp.anotherArrayController= SC.ArrayController.create({
abcBinding: 'MyApp.aSimpleController.content',
xyzBinding: SC.Binding.oneWay('MyApp.anotherObjectController.content'),
observeMe: function(){
var abc= this.get('abc');
var xyz= this.get('xyz');
var result = Rapid.store.find(q);
result.addObserver('status', Rapid.workflowChecksController, 'checkTypeQueryReturn');
the observer function fires only once with a value for status of null.... what am I doing wrong?
Rapid.isBusyController = SC.ArrayController.create({
isBusy: NO,
manageBusyState: function(item){
this.set('isBusy', YES);
if (item && (status = item.get('status'))){
while ((status = item.get('status')) & SC.Record.BUSY){
SC.RunLoop.begin(); //<---no affect
SC.RunLoop.end(); //<--- i guess the jobs in here affect teh status
}
MyApp.SettingsListItemView = SC.View.extend(SC.ContentDisplay,{
layout: {top:0, left:0, width:200, height: 32},
contentDisplayProperties: 'settings somethingElse'.w(),
render: function(context, firstTime){
var content = this.get('content'), view;
var settings = content.get('settings');
var somethingElse = content.get('somethingElse');
view = this.createChildView(SC.LabelView.design({
//layout however you want
value: settings
This works as an ArrayController:
Rapid.workflowCurrentApplicationController = SC.ArrayController.create({
contentBinding: SC.Binding.single('Rapid.workflowApplicationsController.selection'),
userBinding: SC.Binding.oneWay().from('Rapid.rootWorkflowController.content'),
observeMe: function(){
console.log('c '+this.get('content'));
console.log('u: '+ this.get('user'));
}.observes('content', 'user')
});
output
//at a console in firefox: should I see an alert with value 'hi' from the following:
q = Rapid.store.find(MyApp.A);
q.forEach(function(item){
v = MyApp.store.materializeRecord(item.get('storeKey'));
console.log(v);
})
//inside of A SC.Record
aComputedProperty : function(){
SC.TableColumn.create({
key: 'phoneType',
label: 'Type',
exampleView: SC.SelectView,
itemsBinding: 'MyApp.telephonetypesController.arrangedObjects',
valueBinding: 'phoneType',
itemTitleKey: 'displayName'
})
The example view displays but is unpopulated.. I think its because the exampleView points to a class and not an object. Is there a way to make the SelectView show up right?
mainView : SC.TabView.design({
layout : {
top : 36,
left : 40,
right : 40,
bottom : 40
},
nowShowing : 'stepsView',
itemTitleKey : 'title',
itemValueKey : 'value',