Skip to content

Instantly share code, notes, and snippets.

@pegli
Created August 5, 2014 20:20
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 pegli/08bc415e64ca3c08b93d to your computer and use it in GitHub Desktop.
Save pegli/08bc415e64ca3c08b93d to your computer and use it in GitHub Desktop.
var records = Alloy.Collections.records;
records.fetch();
exports.definition = {
config: {
columns: {
title: "TEXT",
notes: "TEXT",
dateTime: "TEXT",
type: "TEXT",
reminder: "INTEGER",
record_id: "INTEGER PRIMARY KEY AUTOINCREMENT"
},
adapter: {
type: "sql",
collection_name: "records",
idAttribute: "record_id"
}
},
extendModel: function(Model) {
_.extend(Model.prototype, {});
return Model;
},
extendCollection: function(Collection) {
_.extend(Collection.prototype, {});
return Collection;
}
};
<Alloy>
<TabGroup>
<Require src="records"/>
</TabGroup>
</Alloy>
<Alloy>
<Collection src="records"/>
<Tab id="records" title="Records" icon="records.png">
<Window title="Records" class="container">
<TitleControl>
<Label id="window_title">Records</Label>
</TitleControl>
<TableView dataCollection="records">
<TableViewRow title="{title}" class="tableRow"></TableViewRow>
</TableView>
<Toolbar bottom="0">
<Items>
<Button id="showArchive" title="Archive"></Button>
<FlexSpace/>
<Button id="newRecord" title="New Record"></Button>
</Items>
</Toolbar>
</Window>
</Tab>
</Alloy>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment