Skip to content

Instantly share code, notes, and snippets.

View ColinCampbell's full-sized avatar

Colin Campbell ColinCampbell

View GitHub Profile
var stagger = 0;
var top = 25;
layer.append('<div class="markingLabel" style="width:125px;height:auto;position:absolute;left:' + Number(offset.left - 62.5) + 'px;top:' + Number(top+stagger) + 'px;color:#000000;">'+label+'</div>');
project/
apps/
project/
Buildfile
frameworks/
table/
config :all, :required => ['sproutcore', 'table']
volumeCount: SC.FormView.row(SC.LabelView, {
layout: {height: 18, width: 50},
label: 'RANDOM'
})
// this gets passed through to:
row: function(label, fieldType, ext)
{
if (label.isClass) {
ext = fieldType;
// setting up an observer
var query = SC.Query.local(MyApp.Record);
var data = MyApp.store.find(query);
var f = function(data) {
if (data.get('status') & SC.Record.READY) {
// data is ready
return YES;
}
addFiniteObserver: function(key, target, method, context){
// normalize. if a function is passed to target, make it the method.
if (method === undefined) {
method = target; target = this ;
}
if (!target) target = this ;
if (typeof method === "string") method = target[method] ;
if (!method) throw "You must pass a method to addObserver()" ;
// apps/test/controllers/display.js
Test.displayController = SC.ObjectController.extend({
nowShowing: 'Test.mainPage.displayView',
showDisplayView: function() {
this.set('nowShowing', 'Test.mainPage.displayView');
},
showCodeView: function() {
var query = SC.Query.local(MyApp.Record);
var data = MyApp.store.find(query);
// old way
var f = function() {
if (data.get('status') & SC.Record.READY) {
data.removeObserver('status', this, f);
// ...
}
};
// in apps/your_app/core.js, add: require('ext/binding');
// place this in apps/your_app/ext/binding.js:
SC.mixin(SC.Binding, {
firstObject: function() {
return this.transform(function(value, isForward) {
if (value && value.isEnumerable) {
value = value.firstObject();
}
return value;
From 9297ae9b2894fddc058d1822731ade9d2a4518c6 Mon Sep 17 00:00:00 2001
From: Colin Campbell <colin.campbell@gmail.com>
Date: Tue, 24 Aug 2010 16:52:33 -0230
Subject: [PATCH] Fixed issue with SC.ManyArray not notifying inverse attributes of correct records that got removed in SC.ManyArray#replace, with tests.
---
frameworks/datastore/system/many_array.js | 2 +-
.../datastore/tests/models/many_attribute.js | 11 +++++++++++
2 files changed, 12 insertions(+), 1 deletions(-)
project: sproutcore
commits: 4156
files : 1062
authors:
1219 Charles Jolley
434 Juan Pinzon
397 Erich Ocean
291 Tom Dale
192 Onar Vikingstad