[backend/memory][xs]: rename DataWrapper to Store.
This commit is contained in:
parent
170f10268c
commit
a6dff8ce28
@ -15,7 +15,7 @@ this.recline.Backend.Memory = this.recline.Backend.Memory || {};
|
|||||||
// @param metadata: (optional) dataset metadata - see recline.Model.Dataset.
|
// @param metadata: (optional) dataset metadata - see recline.Model.Dataset.
|
||||||
// If not defined (or id not provided) id will be autogenerated.
|
// If not defined (or id not provided) id will be autogenerated.
|
||||||
my.createDataset = function(data, fields, metadata) {
|
my.createDataset = function(data, fields, metadata) {
|
||||||
var wrapper = new my.DataWrapper(data, fields);
|
var wrapper = new my.Store(data, fields);
|
||||||
var backend = new my.Backbone();
|
var backend = new my.Backbone();
|
||||||
var dataset = new recline.Model.Dataset(metadata, backend);
|
var dataset = new recline.Model.Dataset(metadata, backend);
|
||||||
dataset._dataCache = wrapper;
|
dataset._dataCache = wrapper;
|
||||||
@ -29,7 +29,13 @@ this.recline.Backend.Memory = this.recline.Backend.Memory || {};
|
|||||||
// Turn a simple array of JS objects into a mini data-store with
|
// Turn a simple array of JS objects into a mini data-store with
|
||||||
// functionality like querying, faceting, updating (by ID) and deleting (by
|
// functionality like querying, faceting, updating (by ID) and deleting (by
|
||||||
// ID).
|
// ID).
|
||||||
my.DataWrapper = function(data, fields) {
|
//
|
||||||
|
// @param data list of hashes for each record/row in the data ({key:
|
||||||
|
// value, key: value})
|
||||||
|
// @param fields (optional) list of field hashes (each hash defining a field
|
||||||
|
// as per recline.Model.Field). If fields not specified they will be taken
|
||||||
|
// from the data.
|
||||||
|
my.Store = function(data, fields) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.data = data;
|
this.data = data;
|
||||||
if (fields) {
|
if (fields) {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
(function ($) {
|
(function ($) {
|
||||||
|
|
||||||
module("Backend Memory - DataWrapper");
|
module("Backend Memory - Store");
|
||||||
|
|
||||||
var memoryData = [
|
var memoryData = [
|
||||||
{id: 0, x: 1, y: 2, z: 3, country: 'DE', label: 'first'}
|
{id: 0, x: 1, y: 2, z: 3, country: 'DE', label: 'first'}
|
||||||
@ -13,7 +13,7 @@ var memoryData = [
|
|||||||
|
|
||||||
var _wrapData = function() {
|
var _wrapData = function() {
|
||||||
var dataCopy = $.extend(true, [], memoryData);
|
var dataCopy = $.extend(true, [], memoryData);
|
||||||
return new recline.Backend.Memory.DataWrapper(dataCopy);
|
return new recline.Backend.Memory.Store(dataCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
test('basics', function () {
|
test('basics', function () {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user