Skip to content

Instantly share code, notes, and snippets.

@jeremy6d
Created October 2, 2008 18:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeremy6d/14414 to your computer and use it in GitHub Desktop.
Save jeremy6d/14414 to your computer and use it in GitHub Desktop.
In body.html:
<%= select_field_view :store,
:name_key => 'name',
:value_key => 'guid',
:sort_key => 'name',
:empty => 'Select a store',
:bind => {
:value => 'TestHarness.storesController.selection',
:objects => 'TestHarness.storesController.arrangedObjects'
} %>
In TestHarness.storesController:
TestHarness.storesController = SC.CollectionController.create(
/** @scope TestHarness.storesController */ {
//content: [],
allowsEmptySelection: false,
allowsMultipleSelection: true,
filterAreas: function() {
alert('observed!');
TestHarness.areasController.set('content', this.get('selection').get('areas'));
}.observes('selection')
}) ;
In TestHarness.Store (model):
TestHarness.Store = SC.Record.extend(
/** @scope TestHarness.Stores.prototype */ {
dataSource: TestHarness.server,
resourceURL: 'rest/rest/stores',
//properties: ['active', 'class', 'corporateOwner', 'name', 'notes', 'storeId', 'updatedBy', 'updatedTimestamp', 'version'],
properties: ['name'],
areas: SC.Record.hasMany('TestHarness.Area', 'store')
}) ;
TestHarness.Store.all = SC.Collection.create({recordType: TestHarness.Store });
in TestHarness.Area (model):
TestHarness.Area = SC.Record.extend(
/** @scope TestHarness.Area.prototype */ {
storeType: 'TestHarness.Store'
}) ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment