sproutcore 1.5.0.rc.1 → 1.5.0.rc.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/VERSION.yml +1 -1
- data/lib/frameworks/sproutcore/Buildfile +9 -4
- data/lib/frameworks/sproutcore/README.md +1 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/QuickLook/Preview.pdf +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/QuickLook/Thumbnail.tiff +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/data.plist +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image10.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image11.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image13.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image15.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image16.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image17.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image18.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image19.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image22.tiff +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image23.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image24.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image25.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image30.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image31.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image8.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image9.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/animation/core.js +23 -25
- data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +160 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +73 -82
- data/lib/frameworks/sproutcore/frameworks/core_foundation/core.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/bind.js +110 -7
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/collection.js +10 -7
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/localization.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/view.js +4 -2
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions.js → core_foundation/ext/handlebars.js} +0 -57
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/object.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/text_field_support.js +11 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/main.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +2 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/application.js +14 -16
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/builder.js +29 -37
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/datetime.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +71 -19
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +3 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/page.js +5 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/selection_set.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +4 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/timer.js +21 -27
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +3 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/array_case.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/object/single_enumerable_case.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/sparse_array.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +93 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/convertLayouts.js +13 -11
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layer.js +2 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/theme.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template.js +6 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +87 -32
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +21 -25
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/cascade.js +15 -19
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +114 -167
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/datastore/models/child_attribute.js +4 -6
- data/lib/frameworks/sproutcore/frameworks/datastore/models/children_attribute.js +2 -4
- data/lib/frameworks/sproutcore/frameworks/datastore/models/fetched_attribute.js +7 -7
- data/lib/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +18 -20
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +74 -72
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +36 -29
- data/lib/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +97 -78
- data/lib/frameworks/sproutcore/frameworks/datastore/system/many_array.js +117 -97
- data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +13 -13
- data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +111 -108
- data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +231 -198
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +146 -145
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/builders.js +21 -21
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/flush.js +49 -50
- data/lib/frameworks/sproutcore/frameworks/datetime/{system → frameworks/core/system}/datetime.js +122 -171
- data/lib/frameworks/sproutcore/frameworks/datetime/{tests → frameworks/core/tests}/system/datetime.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/datetime/{resources → frameworks/localized/resources}/strings.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/system/datetime.js +91 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/core.js +18 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/border.js +23 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_fast_path.js +56 -45
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_group.js +5 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +21 -19
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +82 -77
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/navigation_builder.js +18 -12
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +29 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +148 -107
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +31 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/modal.js +16 -13
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/palette.js +38 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +37 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +247 -144
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/select_button.js +155 -100
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +39 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_data_source.js +9 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_source.js +18 -22
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +27 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +77 -44
- data/lib/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +68 -33
- data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +168 -110
- data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +37 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +187 -123
- data/lib/frameworks/sproutcore/frameworks/desktop/views/date_field.js +73 -49
- data/lib/frameworks/sproutcore/frameworks/desktop/views/disclosure.js +34 -9
- data/lib/frameworks/sproutcore/frameworks/desktop/views/file.js +51 -14
- data/lib/frameworks/sproutcore/frameworks/desktop/views/grid.js +38 -8
- data/lib/frameworks/sproutcore/frameworks/desktop/views/image_button.js +15 -9
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list.js +54 -34
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +113 -42
- data/lib/frameworks/sproutcore/frameworks/desktop/views/master_detail.js +84 -28
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +67 -51
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +122 -35
- data/lib/frameworks/sproutcore/frameworks/desktop/views/navigation.js +40 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/views/navigation_bar.js +28 -18
- data/lib/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +27 -31
- data/lib/frameworks/sproutcore/frameworks/desktop/views/progress.js +118 -68
- data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +117 -61
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scene.js +23 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +241 -77
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroller.js +134 -69
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segment.js +107 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +125 -48
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select.js +165 -69
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +73 -24
- data/lib/frameworks/sproutcore/frameworks/desktop/views/separator.js +19 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/views/source_list.js +16 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/views/source_list_group.js +14 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +43 -37
- data/lib/frameworks/sproutcore/frameworks/desktop/views/split_divider.js +8 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/stacked.js +14 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/views/static_content.js +16 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/tab.js +99 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/thumb.js +13 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/toolbar.js +58 -8
- data/lib/frameworks/sproutcore/frameworks/desktop/views/web.js +34 -18
- data/lib/frameworks/sproutcore/frameworks/desktop/views/well.js +25 -9
- data/lib/frameworks/sproutcore/frameworks/desktop/views/workspace.js +70 -36
- data/lib/frameworks/sproutcore/frameworks/foundation/controllers/tree.js +10 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +28 -17
- data/lib/frameworks/sproutcore/frameworks/foundation/delegates/inline_text_field.js +41 -43
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/pinch.js +42 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/swipe.js +94 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/tap.js +41 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_mixin.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +18 -9
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/collection_content.js +7 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_display.js +7 -8
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +34 -24
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/control.js +48 -18
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/misc.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/tasks/preload_bundle.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/beginEditing.js +0 -11
- data/lib/frameworks/sproutcore/frameworks/foundation/validators/date_time.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +8 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/README.md +24 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/package.json +21 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/qunit/qunit.css +215 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/qunit/qunit.js +1442 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/headless.html +24 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/index.html +18 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/logs.html +17 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/logs.js +150 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/same.js +1421 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/test.js +314 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +369 -60
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +2 -405
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +3 -9
- data/lib/frameworks/sproutcore/frameworks/runtime/private/property_chain.js +50 -45
- data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +20 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +0 -9
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/guidFor.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js +36 -14
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable/enumerable.js +0 -34
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable/enumerable_observers.js +50 -61
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/propertyChanges.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/registerDependentKeys.js +45 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/propertyChanges.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/bindings.js +5 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/enhance.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/testing/core.js +3 -0
- data/lib/frameworks/sproutcore/frameworks/testing/system/plan.js +0 -1
- data/lib/frameworks/sproutcore/frameworks/testing/system/runner.js +0 -1
- data/lib/gen/html_app/templates/apps/@target_name@/@target_name@.js +1 -1
- data/vendor/chance/lib/chance/instance.rb +8 -6
- metadata +41 -31
- data/lib/frameworks/sproutcore/frameworks/testing/jquery.js +0 -3559
- data/lib/frameworks/sproutcore/frameworks/testing/qunit.js +0 -827
@@ -77,7 +77,7 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
77
77
|
Convenience method. Sets the current data source to the passed property.
|
78
78
|
This will also set the store property on the dataSource to the receiver.
|
79
79
|
|
80
|
-
If you are using this from the core.js method of your app, you may need to
|
80
|
+
If you are using this from the `core.js` method of your app, you may need to
|
81
81
|
just pass a string naming your data source class. If this is the case,
|
82
82
|
then your data source will be instantiated the first time it is requested.
|
83
83
|
|
@@ -101,8 +101,8 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
101
101
|
},
|
102
102
|
|
103
103
|
/**
|
104
|
-
Convenience method. Creates a CascadeDataSource with the passed
|
105
|
-
data source arguments and sets the CascadeDataSource as the data source
|
104
|
+
Convenience method. Creates a `CascadeDataSource` with the passed
|
105
|
+
data source arguments and sets the `CascadeDataSource` as the data source
|
106
106
|
for the receiver.
|
107
107
|
|
108
108
|
@param {SC.DataSource...} dataSource one or more data source arguments
|
@@ -123,12 +123,12 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
123
123
|
/**
|
124
124
|
Returns a new nested store instance that can be used to buffer changes
|
125
125
|
until you are ready to commit them. When you are ready to commit your
|
126
|
-
changes, call commitChanges() or destroyChanges() and then destroy()
|
127
|
-
you are finished with the chained store altogether.
|
126
|
+
changes, call `commitChanges()` or `destroyChanges()` and then `destroy()`
|
127
|
+
when you are finished with the chained store altogether.
|
128
128
|
|
129
|
-
|
130
|
-
|
131
|
-
|
129
|
+
store = MyApp.store.chain();
|
130
|
+
.. edit edit edit
|
131
|
+
store.commitChanges().destroy();
|
132
132
|
|
133
133
|
@param {Hash} attrs optional attributes to set on new store
|
134
134
|
@param {Class} newStoreClass optional the class of the newly-created nested store (defaults to SC.NestedStore)
|
@@ -240,7 +240,7 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
240
240
|
|
241
241
|
/**
|
242
242
|
A set of storeKeys that need to be committed back to the data source. If
|
243
|
-
you call commitRecords() without passing any other parameters, the keys
|
243
|
+
you call `commitRecords()` without passing any other parameters, the keys
|
244
244
|
in this set will be committed instead.
|
245
245
|
|
246
246
|
@type SC.Set
|
@@ -248,7 +248,7 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
248
248
|
changelog: null,
|
249
249
|
|
250
250
|
/**
|
251
|
-
An array of SC.Error objects associated with individual records in the
|
251
|
+
An array of `SC.Error` objects associated with individual records in the
|
252
252
|
store (indexed by store keys).
|
253
253
|
|
254
254
|
Errors passed form the data source in the call to dataSourceDidError() are
|
@@ -259,11 +259,11 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
259
259
|
recordErrors: null,
|
260
260
|
|
261
261
|
/**
|
262
|
-
A hash of SC.Error objects associated with queries (indexed by the GUID
|
262
|
+
A hash of `SC.Error` objects associated with queries (indexed by the GUID
|
263
263
|
of the query).
|
264
264
|
|
265
|
-
Errors passed from the data source in the call to
|
266
|
-
are stored here.
|
265
|
+
Errors passed from the data source in the call to
|
266
|
+
`dataSourceDidErrorQuery()` are stored here.
|
267
267
|
|
268
268
|
@type Hash
|
269
269
|
*/
|
@@ -287,8 +287,8 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
287
287
|
// to use these methods.
|
288
288
|
|
289
289
|
/**
|
290
|
-
Returns the current edit status of a storekey. May be one of
|
291
|
-
LOCKED
|
290
|
+
Returns the current edit status of a storekey. May be one of
|
291
|
+
`EDITABLE` or `LOCKED`. Used mostly for unit testing.
|
292
292
|
|
293
293
|
@param {Number} storeKey the store key
|
294
294
|
@returns {Number} edit status
|
@@ -299,7 +299,7 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
299
299
|
},
|
300
300
|
|
301
301
|
/**
|
302
|
-
Returns the data hash for the given storeKey
|
302
|
+
Returns the data hash for the given `storeKey`. This will also 'lock'
|
303
303
|
the hash so that further edits to the parent store will no
|
304
304
|
longer be reflected in this store until you reset.
|
305
305
|
|
@@ -311,12 +311,12 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
311
311
|
},
|
312
312
|
|
313
313
|
/**
|
314
|
-
Returns the data hash for the storeKey
|
314
|
+
Returns the data hash for the `storeKey`, cloned so that you can edit
|
315
315
|
the contents of the attributes if you like. This will do the extra work
|
316
316
|
to make sure that you only clone the attributes one time.
|
317
317
|
|
318
318
|
If you use this method to modify data hash, be sure to call
|
319
|
-
dataHashDidChange() when you make edits to record the change.
|
319
|
+
`dataHashDidChange()` when you make edits to record the change.
|
320
320
|
|
321
321
|
@param {Number} storeKey the store key to retrieve
|
322
322
|
@returns {Hash} the attributes hash
|
@@ -366,12 +366,13 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
366
366
|
},
|
367
367
|
|
368
368
|
/**
|
369
|
-
Replaces the data hash for the storeKey
|
370
|
-
mark them as cloned. This will also call dataHashDidChange() for
|
369
|
+
Replaces the data hash for the `storeKey`. This will lock the data hash
|
370
|
+
and mark them as cloned. This will also call `dataHashDidChange()` for
|
371
|
+
you.
|
371
372
|
|
372
373
|
Note that the hash you set here must be a different object from the
|
373
374
|
original data hash. Once you make a change here, you must also call
|
374
|
-
dataHashDidChange() to register the changes.
|
375
|
+
`dataHashDidChange()` to register the changes.
|
375
376
|
|
376
377
|
If the data hash does not yet exist in the store, this method will add it.
|
377
378
|
Pass the optional status to edit the status as well.
|
@@ -402,16 +403,16 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
402
403
|
|
403
404
|
/**
|
404
405
|
Removes the data hash from the store. This does not imply a deletion of
|
405
|
-
the record. You could be simply unloading the record.
|
406
|
+
the record. You could be simply unloading the record. Either way,
|
406
407
|
removing the dataHash will be synced back to the parent store but not to
|
407
408
|
the server.
|
408
409
|
|
409
410
|
Note that you can optionally pass a new status to go along with this. If
|
410
|
-
you do not pass a status, it will change the status to SC.RECORD_EMPTY
|
411
|
+
you do not pass a status, it will change the status to `SC.RECORD_EMPTY`
|
411
412
|
(assuming you just unloaded the record). If you are deleting the record
|
412
|
-
you may set it to SC.Record.DESTROYED_CLEAN
|
413
|
+
you may set it to `SC.Record.DESTROYED_CLEAN`.
|
413
414
|
|
414
|
-
Be sure to also call dataHashDidChange() to register this change.
|
415
|
+
Be sure to also call `dataHashDidChange()` to register this change.
|
415
416
|
|
416
417
|
@param {Number} storeKey
|
417
418
|
@param {String} status optional new status
|
@@ -431,7 +432,7 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
431
432
|
|
432
433
|
/**
|
433
434
|
Reads the current status for a storeKey. This will also lock the data
|
434
|
-
hash. If no status is found, returns SC.RECORD_EMPTY
|
435
|
+
hash. If no status is found, returns `SC.RECORD_EMPTY`.
|
435
436
|
|
436
437
|
@param {Number} storeKey the store key
|
437
438
|
@returns {Number} status
|
@@ -457,7 +458,7 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
457
458
|
|
458
459
|
/**
|
459
460
|
Writes the current status for a storeKey. If the new status is
|
460
|
-
SC.Record.ERROR
|
461
|
+
`SC.Record.ERROR`, you may also pass an optional error object. Otherwise
|
461
462
|
this param is ignored.
|
462
463
|
|
463
464
|
@param {Number} storeKey the store key
|
@@ -515,7 +516,7 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
515
516
|
|
516
517
|
/** @private
|
517
518
|
Will push all changes to a the recordPropertyChanges property
|
518
|
-
and execute flush() once at the end of the runloop.
|
519
|
+
and execute `flush()` once at the end of the runloop.
|
519
520
|
*/
|
520
521
|
_notifyRecordPropertyChange: function(storeKey, statusOnly, key) {
|
521
522
|
|
@@ -561,13 +562,13 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
561
562
|
// If there are changes other than just the status we need to record
|
562
563
|
// that information so we do the right thing during the next flush.
|
563
564
|
// Note that if we're called multiple times before flush and one call
|
564
|
-
// has statusOnly=true and another has statusOnly=false
|
565
|
-
// (correctly) operate in statusOnly=false mode.
|
565
|
+
// has `statusOnly=true` and another has `statusOnly=false`, the flush
|
566
|
+
// will (correctly) operate in `statusOnly=false` mode.
|
566
567
|
if (!statusOnly) changes.hasDataChanges.push(storeKey);
|
567
568
|
|
568
569
|
// If this is a key specific change, make sure that only those
|
569
570
|
// properties/keys are notified. However, if a previous invocation of
|
570
|
-
// _notifyRecordPropertyChange specified that all keys have changed, we
|
571
|
+
// `_notifyRecordPropertyChange` specified that all keys have changed, we
|
571
572
|
// need to respect that.
|
572
573
|
if (key) {
|
573
574
|
if (!(keys = changes.propertyForStoreKeys[storeKey])) {
|
@@ -774,36 +775,36 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
774
775
|
//
|
775
776
|
|
776
777
|
/**
|
777
|
-
Finds a single record instance with the specified recordType and id or
|
778
|
-
array of records matching some query conditions.
|
778
|
+
Finds a single record instance with the specified `recordType` and id or
|
779
|
+
an array of records matching some query conditions.
|
779
780
|
|
780
781
|
Finding a Single Record
|
781
782
|
---
|
782
783
|
|
783
|
-
If you pass a single recordType and id, this method will return an
|
784
|
-
record instance. If the record has not been loaded into the store
|
785
|
-
this method will ask the data source to retrieve it. If no data
|
786
|
-
indicates that it can retrieve the record, then this method will
|
787
|
-
null
|
784
|
+
If you pass a single `recordType` and id, this method will return an
|
785
|
+
actual record instance. If the record has not been loaded into the store
|
786
|
+
yet, this method will ask the data source to retrieve it. If no data
|
787
|
+
source indicates that it can retrieve the record, then this method will
|
788
|
+
return `null`.
|
788
789
|
|
789
790
|
Note that if the record needs to be retrieved from the server, then the
|
790
791
|
record instance returned from this method will not have any data yet.
|
791
|
-
Instead it will have a status of SC.Record.READY_LOADING
|
792
|
-
the status property to be notified when the record data is
|
793
|
-
you to use it.
|
792
|
+
Instead it will have a status of `SC.Record.READY_LOADING`. You can
|
793
|
+
monitor the status property to be notified when the record data is
|
794
|
+
available for you to use it.
|
794
795
|
|
795
796
|
Find a Collection of Records
|
796
797
|
---
|
797
798
|
|
798
799
|
If you pass only a record type or a query object, you can instead find
|
799
|
-
all records matching a specified set of conditions. When you call
|
800
|
-
in this way, it will create a query if needed and pass it to the
|
801
|
-
source to fetch the results.
|
800
|
+
all records matching a specified set of conditions. When you call
|
801
|
+
`find()` in this way, it will create a query if needed and pass it to the
|
802
|
+
data source to fetch the results.
|
802
803
|
|
803
804
|
If this is the first time you have fetched the query, then the store will
|
804
805
|
automatically ask the data source to fetch any records related to it as
|
805
806
|
well. Otherwise you can refresh the query results at anytime by calling
|
806
|
-
refresh() on the returned RecordArray
|
807
|
+
`refresh()` on the returned `RecordArray`.
|
807
808
|
|
808
809
|
You can detect whether a RecordArray is fetching from the server by
|
809
810
|
checking its status.
|
@@ -813,22 +814,22 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
813
814
|
|
814
815
|
Finding a single record:
|
815
816
|
|
816
|
-
|
817
|
+
MyApp.store.find(MyApp.Contact, "23"); // returns MyApp.Contact
|
817
818
|
|
818
819
|
Finding all records of a particular type:
|
819
820
|
|
820
|
-
|
821
|
+
MyApp.store.find(MyApp.Contact); // returns SC.RecordArray of contacts
|
821
822
|
|
822
823
|
|
823
824
|
Finding all contacts with first name John:
|
824
825
|
|
825
|
-
|
826
|
-
|
826
|
+
var query = SC.Query.local(MyApp.Contact, "firstName = %@", "John");
|
827
|
+
MyApp.store.find(query); // returns SC.RecordArray of contacts
|
827
828
|
|
828
829
|
Finding all contacts using a remote query:
|
829
830
|
|
830
|
-
|
831
|
-
|
831
|
+
var query = SC.Query.remote(MyApp.Contact);
|
832
|
+
MyApp.store.find(query); // returns SC.RecordArray filled by server
|
832
833
|
|
833
834
|
@param {SC.Record|String} recordType the expected record type
|
834
835
|
@param {String} id the id to load
|
@@ -860,7 +861,7 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
860
861
|
|
861
862
|
This method will accept a record type or query and return a record array
|
862
863
|
matching the results. This method was commonly used prior to SproutCore
|
863
|
-
1.0. It has been deprecated in favor of a single find() method instead.
|
864
|
+
1.0. It has been deprecated in favor of a single `find()` method instead.
|
864
865
|
|
865
866
|
For compatibility, this method will continue to work in SproutCore 1.0 but
|
866
867
|
it will raise a warning. It will be removed in a future version of
|
@@ -933,8 +934,8 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
933
934
|
Called by the record array just before it is destroyed. This will
|
934
935
|
de-register it from receiving future notifications.
|
935
936
|
|
936
|
-
You should never call this method yourself. Instead call destroy() on
|
937
|
-
RecordArray directly.
|
937
|
+
You should never call this method yourself. Instead call `destroy()` on
|
938
|
+
the `RecordArray` directly.
|
938
939
|
|
939
940
|
@param {SC.RecordArray} recordArray the record array
|
940
941
|
@returns {SC.Store} receiver
|
@@ -951,10 +952,10 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
951
952
|
/**
|
952
953
|
Called by the record array whenever it needs the data source to refresh
|
953
954
|
its contents. Nested stores will actually just pass this along to the
|
954
|
-
parent store. The parent store will call fetch() on the data source.
|
955
|
+
parent store. The parent store will call `fetch()` on the data source.
|
955
956
|
|
956
|
-
You should never call this method yourself. Instead call refresh() on
|
957
|
-
RecordArray directly.
|
957
|
+
You should never call this method yourself. Instead call `refresh()` on
|
958
|
+
the `RecordArray` directly.
|
958
959
|
|
959
960
|
@param {SC.Query} query the record array query to refresh
|
960
961
|
@returns {SC.Store} receiver
|
@@ -975,8 +976,8 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
975
976
|
},
|
976
977
|
|
977
978
|
/** @private
|
978
|
-
Will ask all record arrays that have been returned from findAll
|
979
|
-
with an SC.Query to check their arrays with the new
|
979
|
+
Will ask all record arrays that have been returned from `findAll`
|
980
|
+
with an `SC.Query` to check their arrays with the new `storeKey`s
|
980
981
|
|
981
982
|
@param {SC.IndexSet} storeKeys set of storeKeys that changed
|
982
983
|
@param {SC.Set} recordTypes
|
@@ -1029,11 +1030,11 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
1029
1030
|
_TMP_REC_ATTRS: {},
|
1030
1031
|
|
1031
1032
|
/**
|
1032
|
-
Given a storeKey
|
1033
|
+
Given a `storeKey`, return a materialized record. You will not usually
|
1033
1034
|
call this method yourself. Instead it will used by other methods when
|
1034
1035
|
you find records by id or perform other searches.
|
1035
1036
|
|
1036
|
-
If a recordType has been mapped to the storeKey, then a record instance
|
1037
|
+
If a `recordType` has been mapped to the storeKey, then a record instance
|
1037
1038
|
will be returned even if the data hash has not been requested yet.
|
1038
1039
|
|
1039
1040
|
Each Store instance returns unique record instances for each storeKey.
|
@@ -1068,12 +1069,12 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
1068
1069
|
// actually creating record instances.
|
1069
1070
|
|
1070
1071
|
/**
|
1071
|
-
Creates a new record instance with the passed recordType and dataHash
|
1072
|
+
Creates a new record instance with the passed `recordType` and `dataHash`.
|
1072
1073
|
You can also optionally specify an id or else it will be pulled from the
|
1073
1074
|
data hash.
|
1074
1075
|
|
1075
1076
|
Note that the record will not yet be saved back to the server. To save
|
1076
|
-
a record to the server, call commitChanges() on the store.
|
1077
|
+
a record to the server, call `commitChanges()` on the store.
|
1077
1078
|
|
1078
1079
|
@param {SC.Record} recordType the record class to use on creation
|
1079
1080
|
@param {Hash} dataHash the JSON attributes to assign to the hash.
|
@@ -1140,12 +1141,12 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
1140
1141
|
},
|
1141
1142
|
|
1142
1143
|
/**
|
1143
|
-
Creates an array of new records. You must pass an array of
|
1144
|
-
plus a recordType and, optionally, an array of ids. This will create an
|
1144
|
+
Creates an array of new records. You must pass an array of `dataHash`es
|
1145
|
+
plus a `recordType` and, optionally, an array of ids. This will create an
|
1145
1146
|
array of record instances with the same record type.
|
1146
1147
|
|
1147
1148
|
If you need to instead create a bunch of records with different data types
|
1148
|
-
you can instead pass an array of
|
1149
|
+
you can instead pass an array of `recordType`s, one for each data hash.
|
1149
1150
|
|
1150
1151
|
@param {SC.Record|Array} recordTypes class or array of classes
|
1151
1152
|
@param {Array} dataHashes array of data hashes
|
@@ -1209,12 +1210,12 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
1209
1210
|
them this way can be faster than retrieving each record and unloading
|
1210
1211
|
it individually.
|
1211
1212
|
|
1212
|
-
You can pass either a single recordType or an array of
|
1213
|
-
you pass a single recordType
|
1213
|
+
You can pass either a single `recordType` or an array of `recordType`s. If
|
1214
|
+
you pass a single `recordType`, then the record type will be used for each
|
1214
1215
|
record. If you pass an array, then each id must have a matching record
|
1215
1216
|
type in the array.
|
1216
1217
|
|
1217
|
-
You can optionally pass an array of
|
1218
|
+
You can optionally pass an array of `storeKey`s instead of the `recordType`
|
1218
1219
|
and ids. In this case the first two parameters will be ignored. This
|
1219
1220
|
is usually only used by low-level internal methods. You will not usually
|
1220
1221
|
unload records this way.
|
@@ -1319,12 +1320,12 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
1319
1320
|
them this way can be faster than retrieving each record and destroying
|
1320
1321
|
it individually.
|
1321
1322
|
|
1322
|
-
You can pass either a single recordType or an array of
|
1323
|
-
you pass a single recordType
|
1323
|
+
You can pass either a single `recordType` or an array of `recordType`s. If
|
1324
|
+
you pass a single `recordType`, then the record type will be used for each
|
1324
1325
|
record. If you pass an array, then each id must have a matching record
|
1325
1326
|
type in the array.
|
1326
1327
|
|
1327
|
-
You can optionally pass an array of
|
1328
|
+
You can optionally pass an array of `storeKey`s instead of the `recordType`
|
1328
1329
|
and ids. In this case the first two parameters will be ignored. This
|
1329
1330
|
is usually only used by low-level internal methods. You will not usually
|
1330
1331
|
destroy records this way.
|
@@ -1472,12 +1473,12 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
1472
1473
|
set of record ids, marking them dirty this way can be faster than
|
1473
1474
|
retrieving each record and destroying it individually.
|
1474
1475
|
|
1475
|
-
You can pass either a single recordType or an array of
|
1476
|
-
you pass a single recordType
|
1476
|
+
You can pass either a single `recordType` or an array of `recordType`s. If
|
1477
|
+
you pass a single `recordType`, then the record type will be used for each
|
1477
1478
|
record. If you pass an array, then each id must have a matching record
|
1478
1479
|
type in the array.
|
1479
1480
|
|
1480
|
-
You can optionally pass an array of
|
1481
|
+
You can optionally pass an array of `storeKey`s instead of the `recordType`
|
1481
1482
|
and ids. In this case the first two parameters will be ignored. This
|
1482
1483
|
is usually only used by low-level internal methods.
|
1483
1484
|
|
@@ -1511,13 +1512,13 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
1511
1512
|
/**
|
1512
1513
|
Retrieves a set of records from the server. If the records has
|
1513
1514
|
already been loaded in the store, then this method will simply return.
|
1514
|
-
Otherwise if your store has a dataSource
|
1515
|
-
dataSource to retrieve the record. Generally you will not need to
|
1516
|
-
call this method yourself. Instead you can just use find()
|
1515
|
+
Otherwise if your store has a `dataSource`, this will call the
|
1516
|
+
`dataSource` to retrieve the record. Generally you will not need to
|
1517
|
+
call this method yourself. Instead you can just use `find()`.
|
1517
1518
|
|
1518
1519
|
This will not actually create a record instance but it will initiate a
|
1519
1520
|
load of the record from the server. You can subsequently get a record
|
1520
|
-
instance itself using materializeRecord()
|
1521
|
+
instance itself using `materializeRecord()`.
|
1521
1522
|
|
1522
1523
|
@param {SC.Record|Array} recordTypes class or array of classes
|
1523
1524
|
@param {Array} ids ids to retrieve
|
@@ -1625,7 +1626,7 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
1625
1626
|
},
|
1626
1627
|
/**
|
1627
1628
|
@private
|
1628
|
-
retreives and calls callback for storkey if exists
|
1629
|
+
retreives and calls callback for `storkey` if exists
|
1629
1630
|
also handles if a single callback is need for one key
|
1630
1631
|
**/
|
1631
1632
|
_retreiveCallbackForStoreKey: function(storeKey){
|
@@ -1670,13 +1671,13 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
1670
1671
|
/**
|
1671
1672
|
Retrieves a record from the server. If the record has already been loaded
|
1672
1673
|
in the store, then this method will simply return. Otherwise if your
|
1673
|
-
store has a dataSource
|
1674
|
+
store has a `dataSource`, this will call the `dataSource` to retrieve the
|
1674
1675
|
record. Generally you will not need to call this method yourself.
|
1675
|
-
Instead you can just use find()
|
1676
|
+
Instead you can just use `find()`.
|
1676
1677
|
|
1677
1678
|
This will not actually create a record instance but it will initiate a
|
1678
1679
|
load of the record from the server. You can subsequently get a record
|
1679
|
-
instance itself using materializeRecord()
|
1680
|
+
instance itself using `materializeRecord()`.
|
1680
1681
|
|
1681
1682
|
@param {SC.Record} recordType class
|
1682
1683
|
@param {String} id id to retrieve
|
@@ -1705,8 +1706,8 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
1705
1706
|
|
1706
1707
|
/**
|
1707
1708
|
Refreshes a record from the server. If the record has already been loaded
|
1708
|
-
in the store, then this method will request a refresh from the
|
1709
|
-
Otherwise it will attempt to retrieve the record.
|
1709
|
+
in the store, then this method will request a refresh from the
|
1710
|
+
`dataSource`. Otherwise it will attempt to retrieve the record.
|
1710
1711
|
|
1711
1712
|
@param {String} id to id of the record to load
|
1712
1713
|
@param {SC.Record} recordType the expected record type
|
@@ -1720,8 +1721,8 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
1720
1721
|
|
1721
1722
|
/**
|
1722
1723
|
Refreshes a set of records from the server. If the records has already been loaded
|
1723
|
-
in the store, then this method will request a refresh from the
|
1724
|
-
Otherwise it will attempt to retrieve them.
|
1724
|
+
in the store, then this method will request a refresh from the
|
1725
|
+
`dataSource`. Otherwise it will attempt to retrieve them.
|
1725
1726
|
|
1726
1727
|
@param {SC.Record|Array} recordTypes class or array of classes
|
1727
1728
|
@param {Array} ids ids to destroy
|
@@ -1735,7 +1736,7 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
1735
1736
|
},
|
1736
1737
|
|
1737
1738
|
/**
|
1738
|
-
Commits the passed store keys or ids. If no
|
1739
|
+
Commits the passed store keys or ids. If no `storeKey`s are given,
|
1739
1740
|
it will commit any records in the changelog.
|
1740
1741
|
|
1741
1742
|
Based on the current state of the record, this will ask the data
|
@@ -1943,19 +1944,19 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
1943
1944
|
recordType and a data hashes and either add or update the
|
1944
1945
|
record in the store.
|
1945
1946
|
|
1946
|
-
The loaded records will be in an SC.Record.READY_CLEAN state, indicating
|
1947
|
+
The loaded records will be in an `SC.Record.READY_CLEAN` state, indicating
|
1947
1948
|
they were loaded from the data source and do not need to be committed
|
1948
1949
|
back before changing.
|
1949
1950
|
|
1950
1951
|
This method will check the state of the storeKey and call either
|
1951
|
-
pushRetrieve() or dataSourceDidComplete()
|
1952
|
+
`pushRetrieve()` or `dataSourceDidComplete()`. The standard state constraints
|
1952
1953
|
for these methods apply here.
|
1953
1954
|
|
1954
|
-
The return value will be the storeKey used for the push. This is often
|
1955
|
-
convenient to pass into loadQuery()
|
1955
|
+
The return value will be the `storeKey` used for the push. This is often
|
1956
|
+
convenient to pass into `loadQuery()`, if you are fetching a remote query.
|
1956
1957
|
|
1957
1958
|
If you are upgrading from a pre SproutCore 1.0 application, this method
|
1958
|
-
is the closest to the old updateRecord()
|
1959
|
+
is the closest to the old `updateRecord()`.
|
1959
1960
|
|
1960
1961
|
@param {SC.Record} recordType the record type
|
1961
1962
|
@param {Array} dataHash to update
|
@@ -1989,19 +1990,19 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
1989
1990
|
recordType and an array of data hashes and either add or update the
|
1990
1991
|
record in the store.
|
1991
1992
|
|
1992
|
-
The loaded records will be in an SC.Record.READY_CLEAN state, indicating
|
1993
|
+
The loaded records will be in an `SC.Record.READY_CLEAN` state, indicating
|
1993
1994
|
they were loaded from the data source and do not need to be committed
|
1994
1995
|
back before changing.
|
1995
1996
|
|
1996
1997
|
This method will check the state of each storeKey and call either
|
1997
|
-
pushRetrieve() or dataSourceDidComplete()
|
1998
|
-
for these methods apply here.
|
1998
|
+
`pushRetrieve()` or `dataSourceDidComplete()`. The standard state
|
1999
|
+
constraints for these methods apply here.
|
1999
2000
|
|
2000
2001
|
The return value will be the storeKeys used for each push. This is often
|
2001
|
-
convenient to pass into loadQuery()
|
2002
|
+
convenient to pass into `loadQuery()`, if you are fetching a remote query.
|
2002
2003
|
|
2003
2004
|
If you are upgrading from a pre SproutCore 1.0 application, this method
|
2004
|
-
is the closest to the old updateRecords()
|
2005
|
+
is the closest to the old `updateRecords()`.
|
2005
2006
|
|
2006
2007
|
@param {SC.Record} recordTypes the record type or array of record types
|
2007
2008
|
@param {Array} dataHashes array of data hashes to update
|
@@ -2038,7 +2039,7 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
2038
2039
|
},
|
2039
2040
|
|
2040
2041
|
/**
|
2041
|
-
Returns the SC.Error object associated with a specific record.
|
2042
|
+
Returns the `SC.Error` object associated with a specific record.
|
2042
2043
|
|
2043
2044
|
@param {Number} storeKey The store key of the record.
|
2044
2045
|
|
@@ -2050,7 +2051,7 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
2050
2051
|
},
|
2051
2052
|
|
2052
2053
|
/**
|
2053
|
-
Returns the SC.Error object associated with a specific query.
|
2054
|
+
Returns the `SC.Error` object associated with a specific query.
|
2054
2055
|
|
2055
2056
|
@param {SC.Query} query The SC.Query with which the error is associated.
|
2056
2057
|
|
@@ -2067,7 +2068,7 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
2067
2068
|
// Mathods called by the data source on the store
|
2068
2069
|
|
2069
2070
|
/**
|
2070
|
-
Called by a dataSource when it cancels an inflight operation on a
|
2071
|
+
Called by a `dataSource` when it cancels an inflight operation on a
|
2071
2072
|
record. This will transition the record back to it non-inflight state.
|
2072
2073
|
|
2073
2074
|
@param {Number} storeKey record store key to cancel
|
@@ -2121,7 +2122,7 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
2121
2122
|
|
2122
2123
|
/**
|
2123
2124
|
Called by a data source when it creates or commits a record. Passing an
|
2124
|
-
optional id will remap the storeKey to the new record id. This is
|
2125
|
+
optional id will remap the `storeKey` to the new record id. This is
|
2125
2126
|
required when you commit a record that does not have an id yet.
|
2126
2127
|
|
2127
2128
|
@param {Number} storeKey record store key to change to READY_CLEAN state
|
@@ -2326,21 +2327,21 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
2326
2327
|
// FETCH CALLBACKS
|
2327
2328
|
//
|
2328
2329
|
|
2329
|
-
// NOTE
|
2330
|
+
// **NOTE**: although these method works on RecordArray instances right now.
|
2330
2331
|
// They could be optimized to actually share query results between nested
|
2331
2332
|
// stores. This is why these methods are implemented here instead of
|
2332
|
-
// directly on Query or RecordArray objects.
|
2333
|
+
// directly on `Query` or `RecordArray` objects.
|
2333
2334
|
|
2334
2335
|
/**
|
2335
2336
|
Sets the passed array of storeKeys as the new data for the query. You
|
2336
2337
|
can call this at any time for a remote query to update its content. If
|
2337
|
-
you want to use incremental loading, then pass a SparseArray object.
|
2338
|
+
you want to use incremental loading, then pass a `SparseArray` object.
|
2338
2339
|
|
2339
2340
|
If the query you pass is not a REMOTE query, then this method will raise
|
2340
2341
|
an exception. This will also implicitly transition the query state to
|
2341
|
-
SC.Record.READY
|
2342
|
+
`SC.Record.READY`.
|
2342
2343
|
|
2343
|
-
If you called loadRecords() before to load the actual content, you can
|
2344
|
+
If you called `loadRecords()` before to load the actual content, you can
|
2344
2345
|
call this method with the return value of that method to actually set the
|
2345
2346
|
storeKeys on the result.
|
2346
2347
|
|
@@ -2365,7 +2366,7 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
2365
2366
|
query. This will put the query into a READY state if it was loading.
|
2366
2367
|
|
2367
2368
|
Note that if the query is a REMOTE query, then you must separately load
|
2368
|
-
the results into the query using loadQueryResults()
|
2369
|
+
the results into the query using `loadQueryResults()`. If the query is
|
2369
2370
|
LOCAL, then the query will update automatically with any new records you
|
2370
2371
|
added to the store.
|
2371
2372
|
|
@@ -2486,7 +2487,7 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
2486
2487
|
//
|
2487
2488
|
|
2488
2489
|
/**
|
2489
|
-
Given a storeKey
|
2490
|
+
Given a `storeKey`, return the `primaryKey`.
|
2490
2491
|
|
2491
2492
|
@param {Number} storeKey the store key
|
2492
2493
|
@returns {String} primaryKey value
|
@@ -2506,8 +2507,8 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
2506
2507
|
},
|
2507
2508
|
|
2508
2509
|
/**
|
2509
|
-
Given a recordType and primaryKey
|
2510
|
-
has not been assigned a storeKey yet, it will be added.
|
2510
|
+
Given a `recordType` and `primaryKey`, find the `storeKey`. If the
|
2511
|
+
`primaryKey` has not been assigned a `storeKey` yet, it will be added.
|
2511
2512
|
|
2512
2513
|
@param {SC.Record} recordType the record type
|
2513
2514
|
@param {String} primaryKey the primary key
|
@@ -2518,9 +2519,9 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
2518
2519
|
},
|
2519
2520
|
|
2520
2521
|
/**
|
2521
|
-
Given a primaryKey value for the record, returns the associated
|
2522
|
-
storeKey
|
2523
|
-
will NOT generate a new storeKey but returned undefined
|
2522
|
+
Given a `primaryKey` value for the record, returns the associated
|
2523
|
+
`storeKey`. As opposed to `storeKeyFor()` however, this method
|
2524
|
+
will **NOT** generate a new `storeKey` but returned `undefined`.
|
2524
2525
|
|
2525
2526
|
@param {SC.Record} recordType the record type
|
2526
2527
|
@param {String} primaryKey the primary key
|
@@ -2531,7 +2532,7 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
2531
2532
|
},
|
2532
2533
|
|
2533
2534
|
/**
|
2534
|
-
Finds all
|
2535
|
+
Finds all `storeKey`s of a certain record type in this store
|
2535
2536
|
and returns an array.
|
2536
2537
|
|
2537
2538
|
@param {SC.Record} recordType
|
@@ -2557,7 +2558,7 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
2557
2558
|
},
|
2558
2559
|
|
2559
2560
|
/**
|
2560
|
-
Finds all
|
2561
|
+
Finds all `storeKey`s in this store
|
2561
2562
|
and returns an array.
|
2562
2563
|
|
2563
2564
|
@returns {Array} set of storeKeys
|
@@ -2577,7 +2578,7 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
2577
2578
|
},
|
2578
2579
|
|
2579
2580
|
/**
|
2580
|
-
Returns string representation of a storeKey
|
2581
|
+
Returns string representation of a `storeKey`, with status.
|
2581
2582
|
|
2582
2583
|
@param {Number} storeKey
|
2583
2584
|
@returns {String}
|
@@ -2648,22 +2649,22 @@ SC.Store.mixin(/** @scope SC.Store.prototype */{
|
|
2648
2649
|
|
2649
2650
|
/** @private
|
2650
2651
|
This array maps all storeKeys to primary keys. You will not normally
|
2651
|
-
access this method directly. Instead use the idFor() and
|
2652
|
-
storeKeyFor() methods on SC.Record
|
2652
|
+
access this method directly. Instead use the `idFor()` and
|
2653
|
+
`storeKeyFor()` methods on `SC.Record`.
|
2653
2654
|
*/
|
2654
2655
|
idsByStoreKey: [],
|
2655
2656
|
|
2656
2657
|
/** @private
|
2657
|
-
Maps all
|
2658
|
-
a primaryKey and recordType that remains constant throughout the
|
2659
|
-
of the application.
|
2658
|
+
Maps all `storeKey`s to a `recordType`. Once a `storeKey` is associated
|
2659
|
+
with a `primaryKey` and `recordType` that remains constant throughout the
|
2660
|
+
lifetime of the application.
|
2660
2661
|
*/
|
2661
2662
|
recordTypesByStoreKey: {},
|
2662
2663
|
|
2663
2664
|
/** @private
|
2664
|
-
Maps some storeKeys to query instance. Once a storeKey is associated
|
2665
|
-
a query instance, that remains constant through the lifetime of the
|
2666
|
-
application. If a Query is destroyed, it will remove itself from this
|
2665
|
+
Maps some `storeKeys` to query instance. Once a `storeKey` is associated
|
2666
|
+
with a query instance, that remains constant through the lifetime of the
|
2667
|
+
application. If a `Query` is destroyed, it will remove itself from this
|
2667
2668
|
list.
|
2668
2669
|
|
2669
2670
|
Don't access this directly. Use queryFor().
|
@@ -2683,8 +2684,8 @@ SC.Store.mixin(/** @scope SC.Store.prototype */{
|
|
2683
2684
|
generateStoreKey: function() { return this.nextStoreKey++; },
|
2684
2685
|
|
2685
2686
|
/**
|
2686
|
-
Given a storeKey returns the primaryKey associated with the key.
|
2687
|
-
If
|
2687
|
+
Given a `storeKey` returns the `primaryKey` associated with the key.
|
2688
|
+
If no `primaryKey` is associated with the `storeKey`, returns `null`.
|
2688
2689
|
|
2689
2690
|
@param {Number} storeKey the store key
|
2690
2691
|
@returns {String} the primary key or null
|
@@ -2694,8 +2695,8 @@ SC.Store.mixin(/** @scope SC.Store.prototype */{
|
|
2694
2695
|
},
|
2695
2696
|
|
2696
2697
|
/**
|
2697
|
-
Given a storeKey
|
2698
|
-
no query is associated with the storeKey
|
2698
|
+
Given a `storeKey`, returns the query object associated with the key. If
|
2699
|
+
no query is associated with the `storeKey`, returns `null`.
|
2699
2700
|
|
2700
2701
|
@param {Number} storeKey the store key
|
2701
2702
|
@returns {SC.Query} query query object
|
@@ -2705,8 +2706,8 @@ SC.Store.mixin(/** @scope SC.Store.prototype */{
|
|
2705
2706
|
},
|
2706
2707
|
|
2707
2708
|
/**
|
2708
|
-
Given a storeKey returns the SC.Record class associated with the key.
|
2709
|
-
If no record type is associated with the store key, returns null
|
2709
|
+
Given a `storeKey` returns the `SC.Record` class associated with the key.
|
2710
|
+
If no record type is associated with the store key, returns `null`.
|
2710
2711
|
|
2711
2712
|
The SC.Record class will only be found if you have already called
|
2712
2713
|
storeKeyFor() on the record.
|
@@ -2719,8 +2720,8 @@ SC.Store.mixin(/** @scope SC.Store.prototype */{
|
|
2719
2720
|
},
|
2720
2721
|
|
2721
2722
|
/**
|
2722
|
-
Swaps the primaryKey mapped to the given storeKey with the new
|
2723
|
-
primaryKey
|
2723
|
+
Swaps the `primaryKey` mapped to the given storeKey with the new
|
2724
|
+
`primaryKey`. If the `storeKey` is not currently associated with a record
|
2724
2725
|
this will raise an exception.
|
2725
2726
|
|
2726
2727
|
@param {Number} storeKey the existing store key
|
@@ -2751,10 +2752,10 @@ SC.Store.mixin(/** @scope SC.Store.prototype */{
|
|
2751
2752
|
},
|
2752
2753
|
|
2753
2754
|
/**
|
2754
|
-
Swaps the recordType recorded for a given storeKey
|
2755
|
-
not call this method directly as it can damage the store behavior.
|
2756
|
-
method is used by other store methods to set the recordType for a
|
2757
|
-
storeKey
|
2755
|
+
Swaps the `recordType` recorded for a given `storeKey`. Normally you
|
2756
|
+
should not call this method directly as it can damage the store behavior.
|
2757
|
+
This method is used by other store methods to set the `recordType` for a
|
2758
|
+
`storeKey`.
|
2758
2759
|
|
2759
2760
|
@param {Integer} storeKey the store key
|
2760
2761
|
@param {SC.Record} recordType a record class
|
@@ -2789,11 +2790,11 @@ SC.Store._getDefaultStore = function() {
|
|
2789
2790
|
|
2790
2791
|
DEPRECATED
|
2791
2792
|
|
2792
|
-
Included for compatibility, loads data hashes with the named recordType
|
2793
|
-
If no recordType is passed, expects to find a recordType property in the
|
2794
|
-
data hashes. dataSource and isLoaded params are ignored.
|
2793
|
+
Included for compatibility, loads data hashes with the named `recordType`.
|
2794
|
+
If no `recordType` is passed, expects to find a `recordType` property in the
|
2795
|
+
data hashes. `dataSource` and `isLoaded` params are ignored.
|
2795
2796
|
|
2796
|
-
Calls SC.Store#loadRecords() on the default store. Do not use this method in
|
2797
|
+
Calls `SC.Store#loadRecords()` on the default store. Do not use this method in
|
2797
2798
|
new code.
|
2798
2799
|
|
2799
2800
|
@param {Array} dataHashes data hashes to import
|
@@ -2831,8 +2832,8 @@ SC.Store.updateRecords = function(dataHashes, dataSource, recordType, isLoaded)
|
|
2831
2832
|
DEPRECATED
|
2832
2833
|
|
2833
2834
|
Finds a record with the passed guid on the default store. This is included
|
2834
|
-
only for compatibility. You should use the newer find() method defined on
|
2835
|
-
SC.Store instead.
|
2835
|
+
only for compatibility. You should use the newer `find()` method defined on
|
2836
|
+
`SC.Store` instead.
|
2836
2837
|
|
2837
2838
|
@param {String} guid the guid
|
2838
2839
|
@param {SC.Record} recordType expected record type
|
@@ -2846,8 +2847,8 @@ SC.Store.find = function(guid, recordType) {
|
|
2846
2847
|
|
2847
2848
|
DEPRECATED
|
2848
2849
|
|
2849
|
-
Passes through to findAll on default store. This is included only for
|
2850
|
-
compatibility. You should use the newer findAll() defined on SC.Store
|
2850
|
+
Passes through to `findAll` on default store. This is included only for
|
2851
|
+
compatibility. You should use the newer `findAll()` defined on `SC.Store`
|
2851
2852
|
instead.
|
2852
2853
|
|
2853
2854
|
@param {Hash} filter search parameters
|